DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Manipulating text with sed

Flow-of-control functions

These functions do no editing on the input lines, but control the application of functions to the lines selected by the address part. (They were used in the example in ``Hold and get functions''.)


!
This function causes the next function written on the same line to be applied to only those input lines not selected by the address part. There are up to two possible addresses.

{
This function causes the next set of commands to be applied as a block to the input lines selected by the addresses of the grouping function. The first of the commands under control of the grouping function can appear on the same line as the { or on the next line. The group of commands is terminated by a matching } on a line by itself. Groups can be nested and can have up to two addresses.

:label
The label function marks a place in the list of editing functions that can be referred to by b and t functions. The label can be any sequence of eight or fewer characters; if two different colon functions have identical labels, an error message is generated, and no execution attempted.

blabel
The branch function causes the sequence of editing functions being applied to the current input line to be restarted immediately after encountering a colon function with the same label. If no colon function with the same label can be found after all the editing functions have been compiled, an error message is produced, and no execution is attempted. A b function with no label is interpreted as a branch to the end of the list of editing commands. Whatever should be done with the current input line is done, and another input line is read; the list of editing commands is restarted from the beginning on the new line. Two addresses are possible.

tlabel
The t function tests whether any substitutions have been made successfully on the current input line. If so, it branches to the label; if not, it does nothing. The flag that indicates that a successful substitution has been executed is reset either by reading a new input line, or by executing a t function.


Next topic: Comments in sed
Previous topic: Hold and get functions

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