Created
February 6, 2017 04:11
-
-
Save TheOpenDevProject/d85d3e941bec0139df2fdf4b3d965b9b to your computer and use it in GitHub Desktop.
CSV => SQL
This file contains hidden or 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
cat file.csv | awk -F$'\t' '{ printf "INSERT INTO country_details VALUES (\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27,\x27%s\x27);",$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19;print ""}' > final.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment