DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(gawk.info) Pattern Summary

Info Catalog (gawk.info) Rules Summary (gawk.info) Rules Summary (gawk.info) Regexp Summary
 
 Pattern Summary
 ---------------
 
    `awk' patterns may be one of the following:
 
      /REGULAR EXPRESSION/
      RELATIONAL EXPRESSION
      PATTERN && PATTERN
      PATTERN || PATTERN
      PATTERN ? PATTERN : PATTERN
      (PATTERN)
      ! PATTERN
      PATTERN1, PATTERN2
      BEGIN
      END
 
    `BEGIN' and `END' are two special kinds of patterns that are not
 tested against the input.  The action parts of all `BEGIN' rules are
 concatenated as if all the statements had been written in a single
 `BEGIN' rule.  They are executed before any of the input is read.
 Similarly, all the `END' rules are concatenated, and executed when all
 the input is exhausted (or when an `exit' statement is executed).
 `BEGIN' and `END' patterns cannot be combined with other patterns in
 pattern expressions.  `BEGIN' and `END' rules cannot have missing
 action parts.
 
    For `/REGULAR-EXPRESSION/' patterns, the associated statement is
 executed for each input record that matches the regular expression.
 Regular expressions are summarized below.
 
    A RELATIONAL EXPRESSION may use any of the operators defined below in
 the section on actions.  These generally test whether certain fields
 match certain regular expressions.
 
    The `&&', `||', and `!' operators are logical "and," logical "or,"
 and logical "not," respectively, as in C.  They do short-circuit
 evaluation, also as in C, and are used for combining more primitive
 pattern expressions.  As in most languages, parentheses may be used to
 change the order of evaluation.
 
    The `?:' operator is like the same operator in C.  If the first
 pattern matches, then the second pattern is matched against the input
 record; otherwise, the third is matched.  Only one of the second and
 third patterns is matched.
 
    The `PATTERN1, PATTERN2' form of a pattern is called a range
 pattern.  It matches all input lines starting with a line that matches
 PATTERN1, and continuing until a line that matches PATTERN2, inclusive.
 A range pattern cannot be used as an operand of any of the pattern
 operators.
 
     Pattern Elements Pattern Overview.
 
Info Catalog (gawk.info) Rules Summary (gawk.info) Rules Summary (gawk.info) Regexp Summary
automatically generated byinfo2html