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

Quoted metacharacter

A regular expression consisting of a literal or character (letter or digit) is a basic regular expression that matches itself. Sometimes, if we need to use the literal meaning of a metacharacter in a regular expression, we precede it with a backslash. If a character is preceded by a single backslash, \, we say the character is quoted. Quoting suppresses the special meaning of a character when matching. For example, if we want to match the dollar sign, $, in a string, we need to quote it as follows:

$ echo -e "500$\n500INR" | awk '/\$/{ print }'

The output on execution of the preceding code is as follows:

500$

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