标题: 问个sed初级问题,谢谢 [打印本页] 作者: sea_soft 时间: 2008-11-14 16:46 标题: 问个sed初级问题,谢谢 test-> cat quote.txt
The honeysuckle band played all night long for only $90.
It was an evening of splendid music and company.
Too bad the disco floor fell through at 23:00.
The local nurse Miss P.Neave was in attendance.
test-> sed -n '/The/,2'p quote.txt
The honeysuckle band played all night long for only $90.
It was an evening of splendid music and company.
The local nurse Miss P.Neave was in attendance.
test-> sed -n '2,/The/'p quote.txt
It was an evening of splendid music and company.
Too bad the disco floor fell through at 23:00.
The local nurse Miss P.Neave was in attendance.
对sed -n '/The/,2'p quote.txt
和sed -n '2,/The/'p quote.txt
的含义不理解,这两种写法分别是什么含义,谢谢作者: ILoveMK 时间: 2008-11-14 16:58
提示: 作者被禁止或删除 内容自动屏蔽作者: sea_soft 时间: 2008-11-14 17:22
谢谢楼上的,但对于
sed -n '/The/,2'p quote.txt --匹配第一个含有The的行到第二行
-----------------------------
有些不理解,为什么显示的结果是:
test-> sed -n '/The/,2'p quote.txt
The honeysuckle band played all night long for only $90.
It was an evening of splendid music and company.
The local nurse Miss P.Neave was in attendance.
而不是:
test-> sed -n '/The/,2'p quote.txt
The honeysuckle band played all night long for only $90.
It was an evening of splendid music and company.
呢,谢谢作者: blackold 时间: 2008-11-18 11:15 标题: 回复 #3 sea_soft 的帖子 建议先看Sed基础。作者: smallstar001 时间: 2008-11-18 11:28