- 论坛徽章:
- 28
|
回复 3# 筷子eason
info sed
=>
`0,/REGEXP/'
A line number of `0' can be used in an address specification like
`0,/REGEXP/' so that `sed' will try to match REGEXP in the first
input line too. In other words, `0,/REGEXP/' is similar to
`1,/REGEXP/', except that if ADDR2 matches the very first line of
input the `0,/REGEXP/' form will consider it to end the range,
whereas the `1,/REGEXP/' form will match the beginning of its
range and hence make the range span up to the _second_ occurrence
of the regular expression.
Note that this is the only place where the `0' address makes
sense; there is no 0-th line and commands which are given the `0'
address in any other way will give an error.
`/REGEXP/'
This will select any line which matches the regular expression
REGEXP. If REGEXP itself includes any `/' characters, each must
be escaped by a backslash (`\').
The empty regular expression `//' repeats the last regular
expression match (the same holds if the empty regular expression is
passed to the `s' command). Note that modifiers to regular
expressions are evaluated when the regular expression is compiled,
thus it is invalid to specify them together with the empty regular
expression. |
|