1.9 Summary
- Programs in
awk
consist of pattern–action pairs.
- An action without a pattern always runs. The default
action for a pattern without one is ‘{ print $0 }’.
- Use either
‘awk 'program' files’
or
‘awk -f program-file files’
to run
awk
.
- You may use the special ‘#!’ header line to create
awk
programs that are directly executable.
- Comments in
awk
programs start with ‘#’ and continue to
the end of the same line.
- Be aware of quoting issues when writing
awk
programs as
part of a larger shell script (or MS-Windows batch file).
- You may use backslash continuation to continue a source line.
Lines are automatically continued after
a comma, open brace, question mark, colon,
‘||’, ‘&&’,
do
, and else
.