Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Pattern ranges z/OS UNIX System Services User's Guide SA23-2279-00 |
|
An instruction of the form:
performs the given action on every line, starting at an occurrence
of pattern1 and ending at the next occurrence
of pattern2 (inclusive). For example, the
instruction
prints
the second field of all lines between an occurrence of Jim and
an occurrence of Linda. Using the hobbies file
as our data file, the output is:
When awk finds a record matching pattern2, it begins to look for a line matching pattern1 again.
Thus, with this instruction:
the output is
awk prints the
first range of records from reading to role and
then starts looking for reading again.awk starts performing the instruction's action as soon
as there is a record that matches pattern1. awk does
not check to make sure that there is a line matching pattern2 in
the rest of the file. This means that:
begins printing at the first record that contains Lori,
and keeps going until it reaches the end of the file. No Jim is
found. |
Copyright IBM Corporation 1990, 2014
|