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. The following command gets me close:
grep -A 1 nmse_gain_constant compare.txt | grep -v nmse_gain_constant But this includes a separator -- line between every line of desired text. Any easy ideas how to get rid of the -- lines?
Example: for an input file that looks like
line line nmse_gain_constant matching line line after first match line line nmse_gain_constant another matching line line after second match line nmse_gain_constant a third matching line line after third match the output is
line after first match -- line after second match -- line after third match but I'd like to have just
line after first match line after second match line after third match