O'Reilly logo

Linux and Unix Shell Programming by David Tansley

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

9.2. awk script

When specifying awk on the command line, an awk script consists of various actions and patterns.

When awk reads in the records or lines one at a time if looks to see if the -F or the FS option (more on FS later) has been set. If it has it will use this to separate the fields, but if the -F option has not been set then awk will assume that a <space> is the field separator, and it will continue to do this until it hits a new line. When a new line has been reached it then knows it has read in a whole record, and will then start on the next line reading in the next record. This reading process for each record continues until the end-of-file has been reached, or no more text exists.

Using Table 9.1 as a guide, awk reads in the file ...

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