Command

How to search for the file in the directory which has the string “ABC” and replace the string “ABC” with “XYZ” in all the files.

find . -type f -exec grep ‘ABC’ -print {} \;


for file in `grep -lr ABC ./*`; do
  sed 's/ABC/XYZ/g' $file >/tmp/$$ && mv /tmp/$$ $file
done