User Guide : Using Content Extraction Language : Language Syntax and Examples : while ( condition ) { statements }
 
Share this page             
while ( condition ) { statements }
The while statement will loop executing { statements } while the condition is true. The condition is a comparison expression. If it is already false when the while statement is first encountered, {statements} are not executed. Note that some statement must eventually assign a false value to the condition or the script will run an infinite loop that will freeze the computer. If this occurs, windows must be re-started before the script can be corrected.
Example
while(NF) { field[ NF ] = $1; shift; } #
Reverse-store fields into array
# fld[1] through fld[NF]