Created
December 29, 2011 12:17
-
-
Save Winslett/1533816 to your computer and use it in GitHub Desktop.
Bash Function to Split MySQL Dumps - BSD Split Only
This file contains 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
function split_db_dump { | |
if [ -f $1 ] | |
then | |
split -p 'Table structure' $1 | |
for file in x* | |
do | |
head -n1 $file | grep -oE '`[^`]+`' | sed 's/`//g' | xargs -n1 -I {} mv $file {} | |
done | |
else | |
echo "File name is required" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can only be used with a dump from one database with MySQL -- not "all-databases."