Search and replace on a large file on OSX using Sed

My code editor of choice, Sublime text 2, crashes when you try to do a search and replace on a large file. This makes it difficult to do a search and replace on a large sql file, as I sometimes need to do when moving a wordpress site from one domain to another

The command-line tool sed can be used instead like this:-

sed -i '.backup' 's/olddomain/newdomain/g' wordpress-backup.sql

This makes a backup of the original file, then updates the original.

Warning: If you run this on a WordPress backup, it’s likely that some serialized data might be corrupted – this will occur if “olddomain” has a different number of characters than “newdomain”. WP-CLI search-replace will safely make the domain replacements, so should be first-choice if it’s an option