How do I get rid of “--” line separator when using grep with context lines?

前端 未结 5 2065
我在风中等你
我在风中等你 2020-12-13 05:27

I have a text file named compare.txt where I want to extract the single line that follows every line that contains the pattern nmse_gain_constant.

5条回答
  •  攒了一身酷
    2020-12-13 06:22

    I do this:

     grep ... | grep -v -- "^--$"
    

    But this works too (on many, not all OS'es)!

    grep --no-group-separator ...
    

    And it doesn't spit out that "--" or even a blank line.

提交回复
热议问题