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.
compare.txt
nmse_gain_constant
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.