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

Using a single character or simple string as a value of the FS

Fields are normally separated by whitespace sequences (spaces, tabs, and newlines). In this case, leading and trailing whitespaces (spaces or tabs) are stripped from the current input line, and fields are separated by a space or a tab. The AWK default value of the FS is a single space, and AWK normally splits the record into fields in this way.

Like other AWK variables, its value can be changed at any time in a program with the assignment operator =. Usually, the correct time to do this is before any input line has been read, hence it is generally defined in the BEGIN block, although we can define these variables anywhere in the script. When the FS is set to any single character ...

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