Ignore:
Timestamp:
Sep 19, 2024, 2:34:43 AM (10 months ago)
Author:
bird
Message:

src/sed: Merged in changes between 4.1.5 and 4.9 from the vendor branch. (svn merge /vendor/sed/4.1.5 /vendor/sed/current .)

Location:
trunk/src/sed
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sed

  • trunk/src/sed/doc/sed.x

    r599 r3613  
    1 .SH NAME
    2 sed \- a Stream EDitor
    3 .SH SYNOPSIS
     1[NAME]
     2sed \- stream editor for filtering and transforming text
     3[SYNOPSIS]
    44.nf
    55sed [-V] [--version] [--help] [-n] [--quiet] [--silent]
    66    [-l N] [--line-length=N] [-u] [--unbuffered]
    7     [-r] [--regexp-extended]
     7    [-E] [-r] [--regexp-extended]
    88    [-e script] [--expression=script]
    99    [-f script-file] [--file=script-file]
     
    4343.RI # comment
    4444The comment extends until the next newline (or the end of a
    45 .B -e
     45.B \-e
    4646script fragment).
    4747.TP
     
    6868which has each embedded newline preceded by a backslash.
    6969.TP
    70 q
     70q [\fIexit-code\fR]
    7171Immediately quit the \*(sd script without processing
    72 any more input,
    73 except that if auto-print is not disabled
    74 the current pattern space will be printed.
    75 .TP
    76 Q
     72any more input, except that if auto-print is not disabled
     73the current pattern space will be printed.  The exit code
     74argument is a GNU extension.
     75.TP
     76Q [\fIexit-code\fR]
    7777Immediately quit the \*(sd script without processing
    78 any more input.
     78any more input.  This is a GNU extension.
    7979.TP
    8080.RI r\  filename
     
    8585Append a line read from
    8686.IR filename .
     87Each invocation of the command reads a line from the file.
     88This is a GNU extension.
    8789.SS
    8890Commands which accept address ranges
     
    98100is omitted, branch to end of script.
    99101.TP
    100 .RI t\  label
    101 If a s/// has done a successful substitution since the
    102 last input line was read and since the last t or T
    103 command, then branch to
    104 .IR label ;
    105 if
    106 .I label
    107 is omitted, branch to end of script.
    108 .TP
    109 .RI T\  label
    110 If no s/// has done a successful substitution since the
    111 last input line was read and since the last t or T
    112 command, then branch to
    113 .IR label ;
    114 if
    115 .I label
    116 is omitted, branch to end of script.
    117 .TP
    118102c \e
    119103.TP
     
    128112.TP
    129113D
    130 Delete up to the first embedded newline in the pattern space.
    131 Start next cycle, but skip reading from the input
    132 if there is still data in the pattern space.
     114If pattern space contains no newline, start a normal new cycle as if
     115the d command was issued.  Otherwise, delete text in the pattern
     116space up to the first newline, and restart cycle with the resultant
     117pattern space, without reading a new line of input.
    133118.TP
    134119h H
     
    138123Copy/append hold space to pattern space.
    139124.TP
    140 x
    141 Exchange the contents of the hold and pattern spaces.
    142 .TP
    143125l
    144126List out the current line in a ``visually unambiguous'' form.
     127.TP
     128.RI l\  width
     129List out the current line in a ``visually unambiguous'' form,
     130breaking it at
     131.I width
     132characters.  This is a GNU extension.
    145133.TP
    146134n N
     
    169157.IR regexp .
    170158.TP
     159.RI t\  label
     160If a s/// has done a successful substitution since the
     161last input line was read and since the last t or T
     162command, then branch to
     163.IR label ;
     164if
     165.I label
     166is omitted, branch to end of script.
     167.TP
     168.RI T\  label
     169If no s/// has done a successful substitution since the
     170last input line was read and since the last t or T
     171command, then branch to
     172.IR label ;
     173if
     174.I label
     175is omitted, branch to end of script.  This is a GNU
     176extension.
     177.TP
    171178.RI w\  filename
    172179Write the current pattern space to
     
    176183Write the first line of the current pattern space to
    177184.IR filename .
     185This is a GNU extension.
     186.TP
     187x
     188Exchange the contents of the hold and pattern spaces.
    178189.TP
    179190.RI y/ source / dest /
     
    223234.I number
    224235Match only the specified line
    225 .IR number .
     236.IR number
     237(which increments cumulatively across files, unless the
     238.B \-s
     239option is specified on the command line).
    226240.TP
    227241.IR first ~ step
     
    230244line starting with line
    231245.IR first .
    232 For example, ``sed -n 1~2p'' will print all the odd-numbered lines in
     246For example, ``sed \-n 1~2p'' will print all the odd-numbered lines in
    233247the input stream, and the address 2~5 will match every fifth line,
    234 starting with the second. (This is an extension.)
     248starting with the second.
     249.I first
     250can be zero; in this case, \*(sd operates as if it were equal to
     251.IR step .
     252(This is an extension.)
    235253.TP
    236254$
     
    240258Match lines matching the regular expression
    241259.IR regexp .
     260Matching is performed on the current pattern space, which
     261can be modified with commands such as ``s///''.
    242262.TP
    243263.BI \fR\e\fPc regexp c
     
    263283.RI 1, addr2
    264284form will still be at the beginning of its range.
     285This works only when
     286.I addr2
     287is a regular expression.
    265288.TP
    266289.IR addr1 ,+ N
     
    292315.BR \et ,
    293316and other sequences.
     317The \fI-E\fP option switches to using extended regular expressions instead;
     318it has been supported for years by GNU sed, and is now
     319included in POSIX.
    294320
    295321[SEE ALSO]
     
    308334.PP
    309335E-mail bug reports to
    310 .BR bonzini@gnu.org .
    311 Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
    312 Also, please include the output of ``sed --version'' in the body
     336.BR bug-sed@gnu.org .
     337Also, please include the output of ``sed \-\-version'' in the body
    313338of your report if at all possible.
Note: See TracChangeset for help on using the changeset viewer.