Skip to content

Instantly share code, notes, and snippets.

@Winslett
Created December 29, 2011 12:17
Show Gist options
  • Save Winslett/1533816 to your computer and use it in GitHub Desktop.
Save Winslett/1533816 to your computer and use it in GitHub Desktop.
Bash Function to Split MySQL Dumps - BSD Split Only
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
}
@Winslett
Copy link
Author

Can only be used with a dump from one database with MySQL -- not "all-databases."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment