I basically want to do this:
cat file | grep \'\' | sed \'s///g\'
without having to
Say you have a file which contains text you want to substitute.
$ cat new.text
A
B
If you want to change A to a then ideally we do the following -
$ sed 's/A/a/' new.text
a
B
But if you don't wish to get lines that are not affected with the substitution then you can use the combination of n and p like follows -
$ sed -n 's/A/a/p' new.text
a