-
Book Overview & Buying
-
Table Of Contents
Linux Command Line and Shell Scripting Bible - Third Edition
By :
The gawk program supports several types of matching patterns to filter data records, in much the same way as the sed editor. Chapter 19 showed two special patterns in action. The BEGIN and END keywords are special patterns that execute statements before or after the data stream data has been read. Similarly, you can create other patterns to execute statements when matching data appears in the data stream.
This section demonstrates how to use matching patterns in your gawk scripts to limit what records a program script applies to.
Chapter 20 showed how to use regular expressions as matching patterns. You can use either a Basic Regular Expression (BRE) or an Extended Regular Expression (ERE) to filter which lines in the data stream the program script applies to.
When using a regular expression, the regular expression must appear before the left brace of the program script that it controls:
$ gawk 'BEGIN{FS=","} /11/{print $1}' data1...
Change the font size
Change margin width
Change background colour