Parsing large mysql dumps

Recently I faced a problem – I had large mysql dump on remote machine and I needed just some tables from it. Dump file was about 900 Mb, bzip’ed – around 60 Mb. I didn’t want to download it just for about 1 Mb of required data. First idea that came into my head – load this dump to the database on remote machine and then dump again only required tables. The problem that I had no possibility to do that – I had just ftp/ssh access. So, I opened this ~1Gb sql file with vi. It opened it even with syntax highlighting! But when I tried to remove 2 millions of unnecessary lines it hanged forever… Emacs wasn’t better.
(more…)

Saturday, July 7th, 2007