Is it possible to use sed to replace words, but avoid replacing words that begin with the letters?For example if I replace man with woman, but women becomes wowoman is it possible to skip woman with sed? Or would you pipe in sed again to remove wo from the beginning of the letters ? sed -i 's/man/woman/g' /usr/share/dict/words | sed 's^wo//'g /usr/share/dict/words which doesn't seem to be working just add another wo on the start. After reading more on piping grep into sed i tried the following commandsudo sed -i 's/man/woman | grep -v 'woman'/g' words1 what i am looking to try out is replace all letter that have man with woman
Using sed to replace words
text processing;sed
Only replace man if it's a single word:sed -i 's/\bman\b/woman/g' /usr/share/dict/words