Mysql Dump Splitter
I saw that several people had already written things like this, but this is the one I wrote.
Some people love perl and some people hate it, but for certain things it works pretty damn well.
#!/usr/local/bin/perl open(DUMP, "<freakishly_large_dump.sql") || die "can't open\n"; while () { if(/^CREATE DATABASE.*/) { if($db) { close DB; $db=""; } ($trash,$db,$trash) = split(/\`/); open(DB, ">${db}.sql"); } if($db) { print DB; } } close DUMP;
