Monday, August 6, 2007

Find and Replace string in files under linux directory tree - Linux Shell Script

This is one of most used command in linux to replace the string in files.

find . -name "*.cpp" | xargs grep -l stringtofind | xargs sed -i s/stringtofind/stringtoreplace/

No comments: