2015-09-27 65 views
0

我有超過1000個文本文件,我需要刪除前6行,並從每個文件的底部刪除一些樣板文本。Sed中的合併語句

我試圖在一個命令在sed,如果可能的話。

下面是各個命令

sed -i.bak '/Some text as starting delimiter/,/Some text as an ending delimiter/d' My-File.txt 

sed -e '1,6d' < MyFile.txt 

難道這相結合?

是怎麼回事?

感謝

回答

1

試試這個:

sed -i.bak -e '/Some text as starting delimiter/,/Some text as an ending delimiter/d' -e '1,6d' My-File.txt 

sed -i.bak '/Some text as starting delimiter/,/Some text as an ending delimiter/d;1,6d' My-File.txt 
+0

工作良好。謝謝 – Slinky