We recently changed our server architecture, requiring that all the websites hosted on our server have localhost changed to an IP Address.
Instead of manually editing this content, I decided to find a simple command line way to accomplish my task. Below you will find the result.
find ./ -type f -exec sed -i 's/findString/replaceString/' {} \;
The preceeding will loop through whichever directory it is run from and locate “findString” and replace it with “replaceString”.

One Response
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
find ./ -type f -exec sed -i ‘s/findString/replaceString/g’ {} \;
Is more correct since /g means globally, the other only grabs the first instance.