Change WordPress URL in sql file via Terminal

You should not use this technique to change the URL of your site : WordPress sometimes stores URLs in serialized strings. You find/replace will corrupt the serialized data and discard the whole content.

You can use interconnect/it search and replace tool to change the domain without any risk. This tool even allow you to run a dry test to check what will be modified.

If you prefer the sed technique, you should escape all special characters that have special meanings in regex like dots :

sed 's|http://www\.domain\.com|http://www\.newdomain\.com|g' mydatabase.sql