version 1.14, 2000/04/15 02:15:13 |
version 1.15, 2000/10/06 23:53:52 |
|
|
must be preceded by a newline or optional whitespace. |
must be preceded by a newline or optional whitespace. |
.sp |
.sp |
.Bl -tag -width "XXXXXX" -compact |
.Bl -tag -width "XXXXXX" -compact |
.It [2addr] function-list |
.It [2addr] Em function-list |
Execute function-list only when the pattern space is selected. |
Execute |
|
.Em function-list |
|
only when the pattern space is selected. |
.sp |
.sp |
.It [1addr]a\e |
.It [1addr] Ns Em a Ns No \e |
.It text |
.It Em text |
.br |
.br |
Write |
Write |
.Em text |
.Em text |
|
|
.Sq N |
.Sq N |
function or by beginning a new cycle. |
function or by beginning a new cycle. |
.sp |
.sp |
.It [2addr]b[label] |
.It [2addr] Ns Em b Ns No [label] |
Branch to the |
Branch to the |
.Sq \&: |
.Sq \&: |
function with the specified label. |
function with the specified label. |
If the label is not specified, branch to the end of the script. |
If the label is not specified, branch to the end of the script. |
.sp |
.sp |
.It [2addr]c\e |
.It [2addr] Ns Em c Ns No \e |
.It text |
.It Em text |
.br |
.br |
Delete the pattern space. |
Delete the pattern space. |
With 0 or 1 address or at the end of a 2-address range, |
With 0 or 1 address or at the end of a 2-address range, |
.Em text |
.Em text |
is written to the standard output. |
is written to the standard output. |
.sp |
.sp |
.It [2addr]d |
.It [2addr] Ns Em d |
Delete the pattern space and start the next cycle. |
Delete the pattern space and start the next cycle. |
.sp |
.sp |
.It [2addr]D |
.It [2addr] Ns Em D |
Delete the initial segment of the pattern space through the first |
Delete the initial segment of the pattern space through the first |
newline character and start the next cycle. |
newline character and start the next cycle. |
.sp |
.sp |
.It [2addr]g |
.It [2addr] Ns Em g |
Replace the contents of the pattern space with the contents of the |
Replace the contents of the pattern space with the contents of the |
hold space. |
hold space. |
.sp |
.sp |
.It [2addr]G |
.It [2addr] Ns Em G |
Append a newline character followed by the contents of the hold space |
Append a newline character followed by the contents of the hold space |
to the pattern space. |
to the pattern space. |
.sp |
.sp |
.It [2addr]h |
.It [2addr] Ns Em h |
Replace the contents of the hold space with the contents of the |
Replace the contents of the hold space with the contents of the |
pattern space. |
pattern space. |
.sp |
.sp |
.It [2addr]H |
.It [2addr] Ns Em H |
Append a newline character followed by the contents of the pattern space |
Append a newline character followed by the contents of the pattern space |
to the hold space. |
to the hold space. |
.sp |
.sp |
.It [1addr]i\e |
.It [1addr] Ns Em i Ns No \e |
.It text |
.It Em text |
.br |
.br |
Write |
Write |
.Em text |
.Em text |
to the standard output. |
to the standard output. |
.sp |
.sp |
.It [2addr]l |
.It [2addr] Ns Em l |
(The letter ell.) |
(The letter ell.) |
Write the pattern space to the standard output in a visually unambiguous |
Write the pattern space to the standard output in a visually unambiguous |
form. |
form. |
|
|
\ev |
\ev |
.El |
.El |
.Pp |
.Pp |
Nonprintable characters are written as three-digit octal numbers (with a |
Non-printable characters are written as three-digit octal numbers (with a |
preceding backslash) for each byte in the character (most significant byte |
preceding backslash) for each byte in the character (most significant byte |
first). |
first). |
Long lines are folded, with the point of folding indicated by displaying |
Long lines are folded, with the point of folding indicated by displaying |
|
|
The end of each line is marked with a |
The end of each line is marked with a |
.Ql $ . |
.Ql $ . |
.sp |
.sp |
.It [2addr]n |
.It [2addr] Ns Em n |
Write the pattern space to the standard output if the default output has |
Write the pattern space to the standard output if the default output has |
not been suppressed, and replace the pattern space with the next line of |
not been suppressed, and replace the pattern space with the next line of |
input. |
input. |
.sp |
.sp |
.It [2addr]N |
.It [2addr] Ns Em N |
Append the next line of input to the pattern space, using an embedded |
Append the next line of input to the pattern space, using an embedded |
newline character to separate the appended material from the original |
newline character to separate the appended material from the original |
contents. |
contents. |
Note that the current line number changes. |
Note that the current line number changes. |
.sp |
.sp |
.It [2addr]p |
.It [2addr] Ns Em p |
Write the pattern space to standard output. |
Write the pattern space to standard output. |
.sp |
.sp |
.It [2addr]P |
.It [2addr] Ns Em P |
Write the pattern space, up to the first newline character to the |
Write the pattern space, up to the first newline character to the |
standard output. |
standard output. |
.sp |
.sp |
.It [1addr]q |
.It [1addr] Ns Em q |
Branch to the end of the script and quit without starting a new cycle. |
Branch to the end of the script and quit without starting a new cycle. |
.sp |
.sp |
.It [1addr]r file |
.It [1addr] Ns Em r file |
Copy the contents of |
Copy the contents of |
.Em file |
.Em file |
to the standard output immediately before the next attempt to read a |
to the standard output immediately before the next attempt to read a |
|
|
cannot be read for any reason, it is silently ignored and no error |
cannot be read for any reason, it is silently ignored and no error |
condition is set. |
condition is set. |
.sp |
.sp |
.It [2addr]s/regular expression/replacement/flags |
.It [2addr] Ns Em s Ns No /re/replacement/flags |
Substitute the replacement string for the first instance of the regular |
Substitute the replacement string for the first instance of the regular |
expression in the pattern space. |
expression in the pattern space. |
Any character other than backslash or newline can be used instead of |
Any character other than backslash or newline can be used instead of |
|
|
is still considered to have been a replacement. |
is still considered to have been a replacement. |
.El |
.El |
.sp |
.sp |
.It [2addr]t [label] |
.It [2addr] Ns Em t Ns No [label] |
Branch to the |
Branch to the |
.Ql \&: |
.Ql \&: |
function bearing the label if any substitutions have been made since the |
function bearing the label if any substitutions have been made since the |
|
|
function. |
function. |
If no label is specified, branch to the end of the script. |
If no label is specified, branch to the end of the script. |
.sp |
.sp |
.It [2addr]w Em file |
.It [2addr] Ns Em w file |
Append the pattern space to the |
Append the pattern space to the |
.Em file . |
.Em file . |
.sp |
.sp |
.It [2addr]x |
.It [2addr] Ns Em x |
Swap the contents of the pattern and hold spaces. |
Swap the contents of the pattern and hold spaces. |
.sp |
.sp |
.It [2addr]y/string1/string2/ |
.It [2addr] Ns Em y Ns No /string1/string2/ |
Replace all occurrences of characters in |
Replace all occurrences of characters in |
.Em string1 |
.Em string1 |
in the pattern space with the corresponding characters from |
in the pattern space with the corresponding characters from |
|
|
.Sq n |
.Sq n |
is replaced by a newline character. |
is replaced by a newline character. |
.sp |
.sp |
.It [2addr]!function |
.Sm off |
.It [2addr]!function-list |
.It Xo [2addr] Em !function No ,\ [2addr] |
|
.Em !function-list |
|
.Xc |
|
.Sm on |
Apply the function or function-list only to the lines that are |
Apply the function or function-list only to the lines that are |
.Em not |
.Em not |
selected by the address(es). |
selected by the address(es). |
.sp |
.sp |
.It [0addr]:label |
.It [0addr] Ns Em : Ns No label |
This function does nothing; it bears a label to which the |
This function does nothing; it bears a label to which the |
.Sq b |
.Sq b |
and |
and |
.Sq t |
.Sq t |
commands may branch. |
commands may branch. |
.sp |
.sp |
.It [1addr]= |
.It [1addr] Ns Em = |
Write the line number to the standard output followed by a newline |
Write the line number to the standard output followed by a newline character. |
character. |
|
.sp |
.sp |
.It [0addr] |
.It [0addr] |
Empty lines are ignored. |
Empty lines are ignored. |
.sp |
.sp |
.It [0addr]# |
.It [0addr] Ns Em # |
The |
The |
.Ql # |
.Ql # |
and the remainder of the line are ignored (treated as a comment), with |
and the remainder of the line are ignored (treated as a comment), with |