Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Friday, July 18, 2008

Linux Find and Sed commands

This days I'm migrating from domainA.com to domainB.com and I need to replace the links in so many files at time.
The best way I found to do this is this:

Find all PHP files with the "domainA.com" string inside it:
find . -name "*.php*" -type f -print0|xargs -0 grep "domainA.com" >> smaCat.log

Replace all PHP it with command:
find ./* -name "*.php*" -type f -exec sed -i 's/domainA.com/domainB.com/g' {} \;

No comments: