Created
March 18, 2014 13:14
-
-
Save joyeecheung/9619766 to your computer and use it in GitHub Desktop.
Litter helper to generate loading command when building TPC-H.
This file contains 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/bash | |
write_to_file() | |
{ | |
file="loaddata.sql" | |
if [ ! -f "$file" ] ; then | |
touch "$file" | |
fi | |
echo 'USE tpch;\n' >> $file | |
DIR=`pwd` | |
for tbl in `ls *.tbl`; do | |
table=$(echo "${tbl%.*}" | tr '[:lower:]' '[:upper:]') | |
echo "LOAD DATA LOCAL INFILE '$DIR/$tbl' INTO TABLE $table" >> $file | |
echo "FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\\\n';\n" >> $file | |
done | |
} | |
write_to_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment