O'Reilly logo

Learning AWK Programming by Shiwang Kalkhanda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Named character classes (POSIX standard)

Named character classes is a feature introduced in the POSIX standard. A named character class is a special notation that describes the lists of characters that have a specific attribute, but the actual characters can vary from country to country or from one character set to another. For example, the alphabetic character set can differ between India and China.

A named character class is valid in a regexp, when it is given inside the brackets of a bracket expression. The named character class is enclosed between '[:' and ':]'.

For example, if you want to search for lines having alphabets (uppercase and lowercase both), we can write it as follows:

$ awk '/[[:alpha:]]/'   dot_regex.txt

The output on execution ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required