Was this helpful?
break;
The break statement causes processing for the current input line to stop. The script control is immediately returned to the first pattern block and the next line is processed. This statement allows the scriptwriter to prevent superfluous processing and speed up program execution. Reject statements do the same thing. Internally there is no difference, they generate exactly the same actions. Two names are provided to allow the word used to better reflect the intent. Break implies we're done processing normally, reject implies we want nothing to do with this line. The only difference is in the readability of the script.
Example
if( $0(1 2) != / / ) # If the input line has spaces in the first 2 positions,
field = $0(5 10) # store the data in positions 5 through 10 in the field variable,
break; # and stop processing the input line.
Both the break and reject statements cause processing for the current input line to stop.
Last modified date: 07/26/2024