Searches for files containing the string in the current directory and subdirectories.

grep -rn "searchme" ./

Replace all occurrences of searchme in the current file with replaceme.

sed -i 's#searchme#replaceme#g' *.txt
sed -i 's/searchme/replaceme/g' *.txt

Replace all occurrences of searchme in subfiles in subdirectories with replaceme.

sed -i 's#searchme#replaceme#g' ./*/*/*.txt
sed -i 's/searchme/replaceme/g' ./*/*/*.txt

Replace all occurrences of searchUrl in subfiles in subdirectories with replaceUrl.

sed -i 's#http://www.searchme.com/#http://replaceme.com/#g' ./*/*/*.html

Replace all occurrences of searchUrl in this file with replaceUrl.

sed -i 's#http://www.searchme.com/#http://replaceme.com/#g' *.html

Finally, check that all swaps are done.

grep -rn "searchme" ./

发表回复

Thanks for your support to bet365fans!