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

Patterns

In pattern-action statements, the pattern is something that determines when an action is to be executed. We can summarize the usage of patterns as follows: 

  • BEGIN { statements }: The statements are executed once before any input has been read.
  • END { statements }: The statements are executed once after all input has been read.
  • expression { statements }: The statements are executed at each input line where the expression is true, that is, non-zero or non-null.
  • / regular expression / { statements }: The statements are executed at each input line that contains a string matched by the regular expression.
  • compound pattern { statements }: A compound pattern combines expressions with && (AND), || (OR), ! (NOT), and parentheses; the statements ...

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