use sed -i to replace in place on a string in a file
use this handy bit to replace in place a string in a file.
sed -i 's#string#otherstring#g' filename
and you will be replacing strings with ninja speed.
I use this to keep my database in sync with WordPress
Just make sure that you that your dev url and your production url are the same length otherwise you will have serialization issues. (namely all the widgets and their settings)
In order to avoid this caveat of monkeypatching my sql file, I make an entry in my host file to have both urls the same length. e.g.
127.0.0.1 somewebsite.dev
and then an entry in my apache virtual hosts file to redirect somewebsite.dev
to localhost/sites/somewebsite
dev url: http://somewebsite.dev
production url: http://somewebsite.com
and then it plays nice with WordPress just dandy.
enjoy!
Written by Jupiter St John
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Perl
Authors
janosgyerik
25.11K
Jean-Remy Duboc
12.22K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#