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

Dot

The "." character is one of those special metacharacters that matches any character, except the end-of-line character. In the following example, we match a sequence of three characters that begin with C and end with T, as follows:

$ echo -e "C1T\nCaT\nC@T\ncAT" | awk '/C.T/ { print }'

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

C1TCaTC@T

Let's create one file for practicing dot regular expressions:

$ vi dot_regex.txt Lets go for a walkSinging is good hobbyWe will talk on this matterPing me when you are free(that is cool)My son birthday is on 24/04/14I will be going to Singapore on 24-04-14(this)

Now, let's execute some regular expressions on the dot_regex.txt file:

  1. Match all strings with any character preceded by ...

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