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 {} \;
| SitePoint Sponsor |


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 {} \;
Code:for file in `grep -lr ABC ./*`; do sed 's/ABC/XYZ/g' $file >/tmp/$$ && mv /tmp/$$ $file done
Bookmarks