find and replace same string in all the folders and files

Find Your String

$ grep -rl find_your_string   your_path_name

example :

$ grep -rl ‘Hello World’ /opt/lampp/htdocs/


Find Your String and replace with other string (.)

$ grep -rl find_your_string . | xargs sed -i ‘s/old_string/new_string/g

example :

$ grep -rl Hello World . | xargs sed -i ‘s/Hello World/Hello World !/g


Find Your String and replace with other string

$ grep -rl find_your_string your_path | xargs sed -i ‘s/old_string/new_string/g

example :

$ grep -rl Hello World /opt/lampp/htdocs/ | xargs sed -i ‘s/Hello World/Hello World !/g