30 July 2009

Replacing the SQL dump schema name "the sed command"

Sometimes I have to pull up multiple instances of the same software copying a tree of folders and the database, making a sql dump, unfortunately, the database name remains the same.

Here is a way to create a new dump with a schema name as you wish!

less sourcedumpname.sql | sed -e 's/oldschemaname/newschemaname/g' > destinationdumpname.sql

And here is done!

No comments: