我想请教的是命令 sed -n -e '/music/'p -e '/music/'= quote.txt 中-e 起什么作用,为什么结果是下面标记红色部分?
[irwin@IRWIN test]$ sed -n -e '/music/'p -e '/music/'= quote.txt
It was an evening of splendid music and company.
2
操作文件quote.txt内容如下:
[irwin@IRWIN 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:10.
The local nurse Miss P.Neave was in attendance.
shell_master 于 2011-11-26 13:34:02发表:
用男人......如果你能看得懂英文.....{:2_93:}
dhqrx 于 2011-11-16 13:41:05发表:
:0wszxc
irwin520 于 2011-11-16 11:14:20发表:
7# age
:0)1 o(∩∩)o...哈哈 现在明白了,多谢。
age 于 2011-11-16 10:14:52发表:
sorry,记错了,写回文件是 -i
-e是允许多重编辑{:3_117:}
irwin520 于 2011-11-16 09:28:17发表:
4# wonderall
基本上明白了。我再学习学习下。多谢。
irwin520 于 2011-11-16 09:25:24发表:
2# liyf86886
我照方法做了测试,发现源文件没有改变。如下结果。
[irwin@IRWIN test]$ sed -n -e 's/music/*****/g' quote.txt
[irwin@IRWIN 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:10.
The local nurse Miss P.Neave was in attendance.
wonderall 于 2011-11-15 18:50:38发表:
要对一个文件重复操作就要用-e,第一次操作打印出包含music的行,第二次操作继续打印包含music行,所以那行要打印两次
age 于 2011-11-15 14:14:20发表:
-e 表示显示同时修改原文件
不加-e只是读取数据,然后输出
liyf86886 于 2011-11-15 12:50:45发表:
路过{:3_114:}