Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Applying more than one instruction z/OS UNIX System Services User's Guide SA23-2279-00 |
|
When an awk program contains several instructions, awk applies
every appropriate instruction to the first record, then every appropriate
instruction to the second record, and so on. Instructions are applied
in order. For example, consider the following awk program,
which has two instructions:
The output of this program is:
awk looks through the file record by record. The
first record to satisfy one of the patterns is:
so awk prints the first field of the record (as dictated by the
second instruction). The next record of interest is:
This
satisfies the first instruction's pattern, so the whole record is
printed. It also satisfies the second instruction's pattern, so the
first field is printed. awk continues through the file, record
by record, executing the appropriate actions when a record satisfies
the pattern. |
Copyright IBM Corporation 1990, 2014
|