Created
February 29, 2012 21:14
-
-
Save complex857/1944412 to your computer and use it in GitHub Desktop.
extract specific db from mysqldump output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# copypasted from the internet, added foreign key check disable/enable | |
line=`grep -m 1 -n "Current Database: .$2" $1 | cut -d ":" -f 1` | |
next=`sed 1,${line}d $1|grep -m 1 -n "Current Database" | cut -d ":" -f 1` | |
end=$(($line + $next -1)) | |
echo set foreign_key_checks = 0';' | |
sed -n ${line},${end}p $1 | |
echo set foreign_key_checks = 1';' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment