Last active
December 18, 2015 15:39
Revisions
-
teabot renamed this gist
Jun 18, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
teabot renamed this gist
Jun 18, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
teabot revised this gist
Jun 18, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,9 +10,9 @@ do first=1 for column in $arr do if [ $first -eq 1 ] ; then nl="" ; pk=" primary key" ; nu="not null" ; else nl=","; pk="" ;nu="null" ; fi echo $nl echo -n " $column text $nu$pk" first=0 done echo "" -
teabot revised this gist
Jun 18, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ for file in *.tsv do name=${file%.tsv} columns=`head -n1 $file` echo -n "CREATE TABLE $name (" arr=$(echo $columns | tr $delim "\n") first=1 for column in $arr -
teabot created this gist
Jun 18, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #!/bin/bash delim=$1 for file in *.tsv do name=${file%.tsv} columns=`head -n1 $file` echo -n "CREATE TABLE $name AS (" arr=$(echo $columns | tr $delim "\n") first=1 for column in $arr do if [ $first -eq 1 ] ; then nl="" ; else nl="," ; fi echo $nl echo -n " $column text null" first=0 done echo "" echo ");" done