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

Positional modifier using integer constant followed by $ (N$):

First we specify percentage (%) sign, then an integer constant followed by $ is a positional specifier and finally format control character. By using positional specifier, we can apply the format specification to the specific argument, otherwise by default format specification is applied to arguments in the order given in format string.

For example, lets print the following message Hello World, first without any positional specifier, as follows:

$ awk 'BEGIN { printf "%s %s\n", "Hello", "World"}'

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

Hello World

Now we print the same message with positional modifier. This time, we make the first format specifier application ...

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