- 论坛徽章:
- 2
|
回复 #8 zngell 的帖子
s/regular expression/replacement/flags
____________________________________________________________
Substitute the replacement string for
instances of the regular expression in the
pattern space. Any character other than
backslash or newline can be used instead of a
slash to delimit the RE and the replacement.
Within the RE and the replacement, the RE del-
imiter itself can be used as a literal charac-
ter if it is preceded by a backslash.
____________________________________________________________
An ampersand (&) appearing in the replacement
will be replaced by the string matching the
RE. The special meaning of & in this context
can be suppressed by preceding it by
backslash. The characters \n, where n is a
digit, will be replaced by the text matched by
the corresponding backreference expression.
For each backslash (\) encountered in scanning
replacement from beginning to end, the follow-
ing character loses its special meaning (if
any). It is unspecified what special meaning
is given to any character other than &, \ or
digits.
____________________________________________________________
A line can be split by substituting a NEWLINE
character into it. The application must
escape the NEWLINE character in the replace-
ment by preceding it with backslash. A sub-
stitution is considered to have been performed
even if the replacement string is identical to
the string that it replaces.
____________________________________________________________
flags is zero or more of:
____________________________________________________________
n n= 1 - 512. Substitute for just the nth
occurrence of the regular expression.
____________________________________________________________
g Global. Substitute for all nonoverlapping
instances of the regular expression rather
than just the first one. If both g and n are
specified, the results are unspecified.
我给你摘出来了,不用我翻译吧?
man sed的
[ 本帖最后由 山野村夫 于 2009-7-14 14:23 编辑 ] |
|