Go to the first, previous, next, last section, table of contents.
An awk program is mostly composed of rules, each consisting of a
pattern followed by an action. The action is enclosed in `{' and
`}'. Either the pattern may be missing, or the action may be
missing, but, of course, not both. If the pattern is missing, the
action is executed for every single line of input. A missing action is
equivalent to this action,
{ print }
which prints the entire line.
Comments begin with the `#' character, and continue until the end of the
line. Blank lines may be used to separate statements. Normally, a statement
ends with a newline, however, this is not the case for lines ending in a
`,', `{', `?', `:', `&&', or `||'. Lines
ending in do or else also have their statements automatically
continued on the following line. In other cases, a line can be continued by
ending it with a `\', in which case the newline is ignored.
Multiple statements may be put on one line by separating them with a `;'. This applies to both the statements within the action part of a rule (the usual case), and to the rule statements.
See section Comments in awk Programs, for information on
awk's commenting convention;
see section awk Statements versus Lines, for a
description of the line continuation mechanism in awk.
Go to the first, previous, next, last section, table of contents.