Created
September 24, 2018 15:56
-
-
Save lovasoa/7f62823201e803a1c7aea5ba5dd88c3c to your computer and use it in GitHub Desktop.
Convert text a text file to sql statements, inserting a new value per line of text
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
| #!/usr/bin/env bash | |
| echo "CREATE TABLE lines (line TEXT);"; | |
| while read line; do | |
| escaped=${line//\'/\'\'}; | |
| echo "INSERT INTO lines VALUES ('$escaped');"; | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage