5.4. awk Commands from within a File
If awk commands are placed in a file, the -f option is used with the name of the awk file, followed by the name of the input file to be processed. A record is read into awk's buffer and each of the commands in the awk file are tested and executed for that record. After awk has finished with the first record, it is discarded and the next record is read into the buffer, and so on. If an action is not controlled by a pattern, the default behavior is to print the entire record. If a pattern does not have an action associated with it, the default is to print the record where the pattern matches an input line.
Example 5.13.
(The Database) $1 $2 $3 $4 $5 Tom Jones 4424 5/12/66 543354 Mary Adams 5346 11/4/63 28765 ... |
Get Linux Shells by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.