- 论坛徽章:
- 0
|
本帖最后由 sosodream 于 2010-07-19 16:20 编辑
If the second address is a REGEXP, then checking for the ending
match will start with the line _following_ the line which matched the
first address: a range will always span at least two lines (except of
course if the input stream ends).
(节选info sed)
当第二段地址为正则时,第二段地址的匹配从第一个地址生效“下一行”为起始
用楼主的例子还说,就是,1匹配了第一行,但/\$90/是从第二行开始匹配的
解决的方法:
1改成0
说明:
`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. |
|