Created
July 31, 2019 15:44
-
-
Save mostlyfine/49a6ab64676b3f39fa94a75bfbb15857 to your computer and use it in GitHub Desktop.
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 | |
| FILENAME=$1 | |
| SPLITCMD=csplit | |
| if [ "$(uname)" == 'Darwin' ]; then | |
| SPLITCMD=gcsplit | |
| fi | |
| $SPLITCMD -f table. $1 /^--\ Table\ structure/ {*} | |
| rm table.00 | |
| for FILE in `ls table.*`; do NAME=$(sed -n 1p ${FILE} | sed 's/.*`\(.*\)`/\1/'); mv ${FILE} ${NAME}.sql; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment