DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Using awk

for statements

The for statement is like that of the C programming language rather than that of the shell:

for (expression1 ; expression2 ; expression3) statement

This has the same effect as the following:

expression1
while (expression2) {
statement
expression3

}

Thus, the following statement does the same job as the while example above:

{ for (i = 1; i <= NF; i++) print $i }


Next topic: Flow control statements
Previous topic: while statements

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003