mysql - Merge Multiple .sql Table Dump Files Into A Single File -
suppose have database , table b. given multiple .sql files b1,b2,...,bn each of corresponds mutually exclusive table dump of b how go combining files b1,b2,...,bn single .sql table file? or how combine import of individual files single table?
there no special tools this. can concatenate files:
$ cat b1.sql b2.sql b3.sql > b_all.sql
except typical content of these .sql files drop table, create table, lot of insert statements. if each of individual dump files formatted that, if restore them in sequence, each drop table , erase data imported preceding file.
you can create dump file without drop/create statements:
$ mysqldump --no-create-info <database> <table> ...
but if have dump files (can't re-dump them), , want rid of drop/create statements in first file:
$ ( cat b1.sql ; cat b2.sql b3.sql | sed -e '/^drop table/,/^-- dumping data/d' ) > b_all.sql
Comments
Post a Comment