Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Assigning values to variables z/OS UNIX System Services User's Guide SA23-2279-00 |
|
Suppose you want to find out how many people have jogging as a hobby. To do this, you have to look through the hobbies file, record by record, and keep a count of the number of records that have jogging in their second field. This means that you have to remember the count from one record to the next. awk programs remember information
by using variables. A variable is a storage
place for information. Every variable has a name and a value. An awk action
of the form:
assigns the specified value to the variable
that has the given name. For example:
assigns the value 0 to the variable count.You can use variables in expressions. For example, the value of
the expression:
is
the current value of count, plus 1. |
Copyright IBM Corporation 1990, 2014
|