Last active
March 12, 2018 17:29
-
-
Save lshapz/1ab5d5a954de7246fae61477bb0aef43 to your computer and use it in GitHub Desktop.
Revisions
-
lshapz revised this gist
Mar 12, 2018 . 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 @@ -31,7 +31,7 @@ tail -n +2 orig.csv > headless.csv * convert csv file into a json file ``` csvtojson final.csv > converted.json ``` ##### Tools: -
lshapz revised this gist
Feb 7, 2018 . 1 changed file with 1 addition 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 @@ -25,8 +25,7 @@ tail -n +2 orig.csv > headless.csv * insert the new header row into the csv file ``` ( echo "headers","as","comma","delimited","strings" ; cat headless.csv ) > final.csv && rm headless.csv ``` * convert csv file into a json file -
lshapz revised this gist
Feb 7, 2018 . 1 changed file with 3 additions and 3 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 @@ -1,10 +1,10 @@ ##### Problem: * 100000 line CSV file. * header row includes unnecessary type definitions in it (i.e. "header1:String,header2:Decimal,header3:INT32") * CSV is too large to open in Numbers/Google Sheets for simple find/replace ##### Solution: * get only the header row @@ -35,7 +35,7 @@ final.csv && rm headless.csv csvtojson useful.csv > converted.json ``` ##### Tools: * bash (MacOS command line/terminal) -
lshapz revised this gist
Feb 7, 2018 . 1 changed file with 3 additions and 3 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 @@ -1,10 +1,10 @@ #####Problem: * 100000 line CSV file. * header row includes unnecessary type definitions in it (i.e. "header1:String,header2:Decimal,header3:INT32") * CSV is too large to open in Numbers/Google Sheets for simple find/replace #####Solution: * get only the header row @@ -35,7 +35,7 @@ final.csv && rm headless.csv csvtojson useful.csv > converted.json ``` #####Tools: * bash (MacOS command line/terminal) -
lshapz created this gist
Feb 7, 2018 .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,44 @@ Problem: * 100000 line CSV file. * header row includes unnecessary type definitions in it (i.e. "header1:String,header2:Decimal,header3:INT32") * CSV is too large to open in Numbers/Google Sheets for simple find/replace Solution: * get only the header row ``` head -n 1 orig.csv > headers.csv ``` * open headers.csv, use find and replace to delte all the ":String" cruft * copy the revised row into a text editor, put quotation marks around all the strings, copy again * get everything but the header row ``` tail -n +2 orig.csv > headless.csv ``` * insert the new header row into the csv file ``` ( echo "headers","as","comma","delimited","strings" ; cat headless.csv ) > final.csv && rm headless.csv ``` * convert csv file into a json file ``` csvtojson useful.csv > converted.json ``` Tools: * bash (MacOS command line/terminal) * a spreadsheet app (MacOS Numbers.app) * [csvtojson](https://github.com/Keyang/node-csvtojson) npm package