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
There is no need to pipe to so many greps or use other tools (for example, sed) if you use AWK:
awk '/nmse_gain_constant/{getline;print }' compare.txt