I want to replace all occurrences of certain characters in my file with words. My question is, can I do that for all the characters using a single command. I am using the following command for replacing every occurrence of 'a' with 'apples'
sed 's/a/apple/g' sample.txt
I don't want to write 3 or 4 similar commands to replace every occurrence of 'b', 'c', 'd' with some words. Is there any way out to extend the above command to suit my need or do I need to use the same three times ?
echaracters as it will affect theeinappleas well. You may want to investigate the Regexp features of sed, especially the "word boundary" characters.sed -i. It should allow in-place modification but is sometimes dangerous! copy the file first!