forked from mangosArchives/Mangos-Zero-database-old
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmysql_cleanup
More file actions
executable file
·20 lines (15 loc) · 804 Bytes
/
mysql_cleanup
File metadata and controls
executable file
·20 lines (15 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
#
# This script will turn single-line INSERT statements in the SQL dumps
# into readable multi-line statements.
# - Include common libraries and settings ------------------------------------
source "libui"
source "mysql_info"
# - Prepare required variables -----------------------------------------------
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TMP_FOLDER=${TMPDIR-/tmp}
# ----------------------------------------------------------------------------
# - Replace VALUES ( by VALUES\n( --------------------------------------------
find ${DIR} -name '*.sql' -type f -exec perl -pi -e 's/VALUES \(/VALUES\n\(/g' {} \;
# - Replace huge insert by multi-line inserts --------------------------------
find ${DIR} -name '*.sql' -type f -exec perl -pi -e 's/\),\(/\),\n\(/g' {} \;