Awk Pattern Selection Method
Awk Pattern Selection Method
relational expression {statement(s)}
- Statement(s) executed for each input line where the expression is true.
/regular expression/ {statement(s)}
- Statement(s) executed for each input line where the the input line satisfies string matched by the regular expression.
compound pattern {statement(s)}
- Compound pattern combines expressions with the boolean relations for:
&& logical and|| logical or! logical not
- Parentheses are also used for grouping the expressions.
- Action statements are executed for the input lines where the compound pattern is true.
pattern1 , pattern2 {statement(s)}
- Pattern range matches those records between pattern1 & pattern2. In other words, actions will be performed on those records once the first input line satisfies pattern1 until a successive record matches pattern2.