- 论坛徽章:
- 11
|
本帖最后由 刺客阿地 于 2012-05-27 12:00 编辑
在看书当中看到sed章节,有个例子我不是很明白。
例如有个本文文件test2.txt
$ cat test2.txt
this is script test, we are test bash shell
this is script test, we are test bash shell
this is script test, we are test bash shell
this is script test, we are test bash shell
this is script test, we are test bash shell
我利用这个命令,指定删除第一行:
$ sed '/number 1/d' test2.txt
this is script test, we are test bash shell
this is script test, we are test bash shell
this is script test, we are test bash shell
this is script test, we are test bash shell
this is script test, we are test bash shell
为啥执行命令后,test2.txt文本输出还有第一行存在?
另外说明一点,上述命令我知道的,执行后,不会真正删除test2.txt的第一行内容,但是执行 sed '/number 1/d' test2.txt命令输出,应该不会显示第一行的,为啥还显示第一行呢?
|
|