Grep also allows the use of international character pattern matching or class name form of pattern matching.
|Class||Regular expression equivalent|
|[[:space:]]||same as a space or a tab|
Let’s use a couple of examples on our file to see how these work. We want to extract all the product codes that start with a ‘5’ and have at least two upper case letters following them. This will do it:
$ grep '5[[:upper:]][[:upper:]]' data.f 483 Sept 5AP1996 USP 65.00 LVX2C 189 483 may 5PA1998 USP 37.00 KVM9D 644
If we wanted to get all product codes that ended a ‘P’ or ‘D’ we could do ...