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