find&replace text with bash on CENTOS/RHEL

You can find and replace text on one or multiple file at once using sed RHEL command


sed -i 's/TEXT-TO-FIND/REPLACE-WITH/g' filename.txt


Find and replace text on multiple files with .txt extention

sed -i 's/TEXT-TO-FIND/REPLACE-WITH/g' *.txt

Replace TEXT-TO-FIND and REPLACE-WITH with the text you’re looking for and its replacment


sed -i 's/thursday/friday/g' weekdays.txt

The above command replaces the word ‘thursday’ with ‘friday’ on file weekdays.txt