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

后端 未结 4 626
感动是毒
感动是毒 2021-01-05 17:37

Can I use sed to check the first line of some command\'s output (to stdout) and delete this very first line if it matches a certain pattern?

Say, the co

4条回答
  •  温柔的废话
    2021-01-05 18:16

    sed '1{//{/GH/!d}}' input
    

    The error in your expression can be fixed like this:

    sed '1{//d}' input
    

提交回复
热议问题