Using “SED” command to replace URL strings in SQL files
We want to change all references of events.ewea.org to www.ewea.org in an SQL dump, so a sed command line for this may be:
sed 's/OLDPHRASE/NEWPHRASE/g' database.sql > database.new.sql
sed 's/events\.ewea\.org/www\.ewea\.org/g' event.sql > event.new.sql
Note: We have to escape the periods and any slashes.
This is particularly useful when migrating a WordPress website off the development server and onto the production server.