The awk command line
The simplest awk command line is:
awk 'program' datafile
The awk program
is enclosed in single-quote or apostrophe (') characters.
The datafile argument gives the name of
the data file. For example: awk '$1 == "Linda"' hobbies
executes
the program: $1 == "Linda"
on the data file hobbies.If you are using the z/OS® shell,
you can type in a multiline program within single quotation marks,
as in:
awk '
$1 == "Linda"
$2 == "bridge" { print $1 }
' hobbies
awk assumes that blanks or horizontal
tabs separate fields in a record. If the data file uses different
field separator characters, you must indicate this on the command
line. You can do this with an option of the form:
–Fstring
where string lists
the characters used to separate fields. For example: awk –F":" '{ print $3 }' file.dat
indicates
that the given data file uses colon (:) characters
to separate record fields. The –F option
must come before the quoted program instructions.awk also allows you to define the value of variables on the command line by using the –v option. See z/OS UNIX System Services Command Reference for details.