MPE/iX Shell and Utilities Reference Manual, Vol 1
awk(1) MPE/iX Shell and Utilities awk(1)
# do-while loop
do
statement
while (condition)
# for loop
for (expression1; condition; expression2)
statement
The for statement is equivalent to:
expression1
while (condition){
statement
expression2
}
The for statement can also have the form
for (i in array)
statement
awk performs the statement once for each element in array; on each repetition, the variable i
contains the name of a subscript of array, running through all the subscripts in an arbitrary
order. If array is multi-dimensional (has multiple subscripts), i is expressed as a single string
with the SUBSEP character separating the subscripts.
The statement
break
exits a for or a while loop immediately.
continue
stops the current iteration of a for or while loop and begins the next iteration (if there is
one).
next
terminates any processing for the current input record and immediately starts processing the
next input record. Processing for the next record begins with the first appropriate rule.
exit[(expr)]
immediately goes to the END action if it exists; if there is no END action, or if awk is already
performing the END action, the awk program terminates. awk sets the exit status of the pro-
gram to the numeric value of expr. If you omit (expr), the exit status is 0.
1-30 Commands and Utilities