Patterns in awk control the execution of rules—a rule is
executed when its pattern matches the current input record.
The following is a summary of the types of awk patterns:
/regular expression/A regular expression. It matches when the text of the input record fits the regular expression. (See Regular Expressions.)
expressionA single expression. It matches when its value is nonzero (if a number) or non-null (if a string). (See Expressions as Patterns.)
begpat, endpatA pair of patterns separated by a comma, specifying a range of records. The range includes both the initial record that matches begpat and the final record that matches endpat. (See Specifying Record Ranges with Patterns.)
BEGINENDSpecial patterns for you to supply startup or cleanup actions for your
awk program.
(See The BEGIN and END Special Patterns.)
BEGINFILEENDFILESpecial patterns for you to supply startup or cleanup actions to be
done on a per-file basis.
(See The BEGINFILE and ENDFILE Special Patterns.)
emptyThe empty pattern matches every input record. (See The Empty Pattern.)