如何使用sed刪除包含特定模式的第一行?刪除與模式匹配的第一行
例如,我想刪除的第一行從這個文檔匹配FAA
:
1. foo bar quuz
2. foo FAA bar (this should go)
3. quuz quuz FAA (this should remain)
4. quuz FAA bar (this should also remain)
結果應該是
1. foo bar quuz
3. quuz quuz FAA (this should remain)
4. quuz FAA bar (this should also remain)
一種用於POSIX溶液SED將不勝感激,GNU SED沒問題。
+1漂亮,短,特別是'0'地址,以及考慮! – Kent
0不符合posix(不在我的AIX上工作),但最好的行動路線時 – NeronLeVelu
@NeronLeVelu'GNU sed是好的' – Kent