Joined July 2016
·

jtremblay

Magic and stuff
·
·

Posted to Replace word with SED over 1 year ago

You should also consider word boundaries is you want to replace whole words.
=> sed -i 's/\bwordtoreplace\b/wordreplaced/g' namefile

without \b
echo 'this is a test' | sed 's/is/banana/g'
thbanana banana a test

with \b
echo 'this is a test' | sed 's/\bis\b/banana/g'
this banana a test

Achievements
1 Karma
175 Total ProTip Views