Given I have a file with several words, how can I do the following:
How can I replace AAA for BBB in a file with Unix?
sed -i.bak 's/AAA/BBB/g'
sed s/AAA/BBB/g input.txt > output.txt
You can then check output.txt and copy it over input.txt. Learn more about sed here.
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
3 years ago