Problem
Following on from the last post on removing lines with sed, how do we use sed to substitute output on the fly?
Solution
This says substitute occurences of PATT with REPLACE global (or all occurences).
sed 's/PATT/REPLACE/g' filename
Example
So to replace all occurences of Unix with UNIX:
sed 's/Unix/UNIX/g' filename
We can also replace patterns, with variable values, like this:
sed "s/PATT/${THEVAR}/g" filename