dbsplitter/splitTable.sh
2016-03-27 21:19:38 +02:00

11 lines
312 B
Bash

DUMP_FILE=$1
TARGET_FOLDER=$2
for tablename in $(grep "Table structure for table " $1 | awk -F"\`" {'print $2'})
do
sed -n "/^- Table structure for table \`$tablename\`/,/^- Table structure for table/p" $1 > $TARGET_FOLDER/$tablename.sql
TABLE_COUNT=$((TABLE_COUNT+1))
done;
rm -f $1