爲了項目的目的,我只能使用sed,而不是grep,awk或print。使用sed刪除多行
我該如何使用sed來刪除行開始,比如說bbbb或eeee,直到包名的末尾。 每個包的結尾並不是唯一且隨機的,行數也是隨機的,有時候9行,有時是4或5.
不能得到這個工作。由於我可以控制輸入的唯一事情是要開始的包名稱,但是如何將其刪除到該包的末尾。
Package: aaaa
Status:
Priority:
Section:
Installed-Size:
Maintainer:
Architecture:
Version:
Depends:
Description:
Name:
Icon
Package: bbbb
Status:
Priority:
Section:
Installed-Size:
Maintainer:
Architecture:
Version:
Depends:
Description:
Name:
Homepage:
Package: cccc
Status:
Priority:
Section:
Depends:
Description:
Name:
Homepage:
Package: dddd
Status:
Priority:
Section:
Installed-Size:
Maintainer:
Architecture:
Version:
Depends:
Description:
Name:
Homepage:
Package: eeee
Status:
Priority:
Section:
Installed-Size:
Maintainer:
Architecture:
Version:
Package: dddd
Status:
Priority:
Section:
Installed-Size:
Maintainer:
Architecture:
Text:
Package: ffff
Status:
Priority:
Section:
Installed-Size:
Maintainer:
Architecture:
Version:
Depends:
Description:
Name:
Link:
Package: ggg
Status:
Priority:
Section:
Installed-Size:
Depends:
Description:
Name:
Homepage:
請重新問你的問題。你試圖完成的是完全不可理解的。也許期望的輸出將有助於... – St0fF 2014-10-09 07:43:27
並分享您嘗試過的以及您搜索的內容。 SO不是免費的代碼服務。 – Tensibai 2014-10-09 07:44:10
而你的答案已經在[此線程](http://unix.stackexchange.com/questions/10226/multiline-pattern-match-using-sed-awk-or-grep)你只需要適應它 – Tensibai 2014-10-09 07:53:20