Alex Hughes || microfeeds:

You can have them fresh on your plate everyday using your favourite feed reader: 'http://microfeed.ahughes.org/feed.php'

Special thanks to my friend and colleague Karen for the 5 minute godly touches on my horrible CSS file.

 

Restore one table from huge MySQL dump file

I recently needed to restore a single table from a huge 3GB SQL dump file.

Luckily enough, I found the following solution on Stack Overflow, but I will copy it here, to have it handy.

So, essentially, by replacing "mytable" with the actual table's name, run the following command:

sed -n -e '/CREATE TABLE.*mytable/,/CREATE TABLE/p' full_dump.sql > table_dump.sql

I may take it a step further and tell you that if you want to have any commands before the table creation, like USE myschema you should create the table_dump.sql file yourself and then append sed's contents by using the ">>" operator.

Perhaps if you still get errors, you may have to open the file with a decent editor like vim to get rid of certain lines that mysqldump creates. Still a better alternative to opening the entire dump.

A brilliant way of using sed to getting what you want.

Fri Jul 10th, 16:07:01 Greenwich Mean Time (GMT)

More Feeds

Microfeed is proudly powered by Microfeed. MicrofeedCeption.