Replace word with SED
sed -i 's/wordtoreplace/wordreplaced/g' namefile
Written by muquiutti
Related protips
1 Response
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
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Linux
Authors
Related Tags
#linux
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#