- 论坛徽章:
- 0
|
我有个文件,其内容是
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:10.
The local nurse Miss P.Neave was in attendance.
我使用如下命令,得到如下结果
- [caoke@Linux ~]$ sed -n '/It/,2'p tmp.sed
- It was an evening of splendid music and company.
复制代码 我使用如下命令,得到如下结果
- [caoke@Linux ~]$ sed -n '/an/,2'p tmp.sed
- 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.
- [color=Red]很奇怪,不是应该在第二行范围内搜索吗?[/color]
复制代码 这两个命令有什么区别
- sed -n '/an/,2'p tmp.sed
- sed -n '2,/an/'p tmp.sed
复制代码 不胜感激 |
|