Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Using special patterns z/OS UNIX System Services User's Guide SA23-2279-00 |
|
BEGIN and END are two special patterns.
Consider the action:
awk first finds the value of:
and then assigns
this value to count. Thus this action increases the value
of count by 1. In a program, you can use this sort of action
to count how many people have jogging as a hobby:
Let's look
at this program line by line.
In this example, awk begins by assigning the value 0 to count:
adds 1 to count every time awk finds a record
with jogging in the second field.
When awk has looked at all the records, the printf action
prints the count of people who jog. The output from the program is:
Notice how the
value of count was printed in place of the %d placeholder.
For more information about using a placeholder, see Placeholders. |
Copyright IBM Corporation 1990, 2014
|