回复 7# weichenxiehou
是的
再往深处讲:
range operator maintains its own Boolean state.
It is false as long as its left operand is false. Once the left operand is true, the range operator stays true until the right operand is true, after which the range operator becomes false again.
The operator doesn’t become false until the next time it is evaluated. 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).
第一个和第二个address分别是number和REGEXP的情况有不同的组合,具体表现也不同。
这是很多用sed的人搞不清楚的。
对于初学者来说只看教程很难理解,遇到具体问题的时候再慢慢学习吧。 |