Monday, October 7, 2013

Find and Replace the String

So long time i was searching for single terminal grep or sed or find command that could find and replace all the place the string value in the document!

Finally i found the command!.

find /path -type f -exec sed -i 's/OldString/NewString/g' {} \;

This command will replace the OldString with NewString. If you want to search with the folder then your path should be "./"