sed指令進階操做

刪除

刪除不匹配的第一行

sed -e '1!b' -e '/GH/!d' file

Linux SED script find the 1st line that match pattern and delete itlinux

刪除第一次匹配的行

echo -e "AB\nMN2\nMN3" | sed "0,/N/{//d;}"

How to conditionally remove first line only with sed when it matches?bash

參考資料

sed命令.net

相關文章
相關標籤/搜索