Could someone tell me how to replace a word at a particular line by a single SED or AWK command?
e.g. I have a file with the contents below:
$ cat file1
111 AAA
333 CCC
222 BBB
444 CCC
I want to replace the word "CCC" with a blank to get the desired output below:
111 AAA
333 CCC
222 BBB
444
I can get the above by the command below but I want it to work for any line using simpler commands.
paste -s file1 | sed -e s/CCC$// | tr -s '\11' '\12'
Any help will be appreciated.
Steve