Intro Summary (The GNU Awk User’s Guide)
From Get docs
Gawk/docs/latest/Intro-Summary
Previous: When, Up: Getting Started [Contents][Index]
1.9 Summary
- Programs in
awk
consist ofpattern
–action
pairs. - An
action
without apattern
always runs. The defaultaction
for a pattern without one is ‘{ print $0 }
’. - Use either ‘
awk 'program' files
’ or ‘awk -f program-file files
’ to runawk
. - You may use the special ‘
#!
’ header line to createawk
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
, andelse
.