How to make sed remove lines not matched by a substitution

前端 未结 4 1983
生来不讨喜
生来不讨喜 2020-12-10 10:22

I basically want to do this:

cat file | grep \'\' | sed \'s///g\'

without having to

4条回答
  •  攒了一身酷
    2020-12-10 11:20

    How about:

    cat file | sed 'd//'
    

    Will delete matching patterns from the input. Of course, this is opposite of what you want, but maybe you can make an opposite regular expression?

    Please not that I'm not completely sure of the syntax, only used it a couple of times some time ago.

提交回复
热议问题