sed指令进阶操作

删除

删除不匹配的第一行

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

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

删除第一次匹配的行

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

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

参考资料

sed命令

posted @ 2017-01-22 17:44  SupremeHover  阅读(195)  评论(0编辑  收藏  举报