Created
September 18, 2013 02:46
-
-
Save taion809/6603818 to your computer and use it in GitHub Desktop.
split sql dump add transaction
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/sh | |
| split -l 5000 dbdump.sql | |
| find ./x* -type f -print0 | while IFS= read -r -d '' filename;\ | |
| do sed -i '1s/^/\n\nSET FOREIGN_KEY_CHECKS=0;\nSET SQL_MODE = \"NO_AUTO_VALUE_ON_ZERO\";\nSET AUTOCOMMIT = 0;\nSET time_zone = \"+00:00\";\nSTART TRANSACTION;\n\n /' $filename;\ | |
| done | |
| find ./x* -type f -print0 | while IFS= read -r -d '' filename;\ | |
| do sed -i '$s/$/\n\nCOMMIT;\nSET FOREIGN_KEY_CHECKS=1;\n\n /' $filename;\ | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment