Trying this again...
I have a survey that I'm trying to analyze in SQL and some people have commented using a comma (i.e. "Sick today, need Vit C.") and when I'm trying to load it into SQL that comma is reading as the delimiter and not reading the last column.
My csv is delimited by commas so I understand whats happening I just don't know how to change only commas inside text.
Should I download the file from google sheets as tab separated?
Can I sub the any commas in that column (the comments section) to be a space using sed, grep, tr or awk?
I setup questionnaire
table in postgresSQL and I set comments
column to TEXT
.
I have the VassarXCTFReadinessQuestionnaire.csv
saved in my server.
I'm converting VassarXCTFReadinessQuestionnaire.csv
to quest_ready.csv
with:
cat VassarXCTFReadinessQuestionnaire.csv | cut -d',' -f1-11 | grep -v ',NA' > quest_ready.csv
Actual data in VassarXCTFReadinessQuestionnaire.csv
:
W/ Comments and comma in comment column:
11/7/18,Jackson Picker,3,3,3,3,4,3,7,"feeling alright, same situation with the hip.",4.1,,
w/o comments:
11/7/18,Hannah Happy,4,2,2,3,3,4,9,,4.35,,
w/ comments w/o comma:
11/6/18,Hannah Happy,4,2,2,3,3,4,9,All Good!,4.35,,
Desired result in quest_ready.csv is:
11/7/18,Jackson Picker,3,3,3,3,4,3,7,"feeling alright same situation with the hip.",4.1,,
11/7/18,Hannah Happy,4,2,2,3,3,4,9,,4.35,,
11/6/18,Hannah Happy,4,2,2,3,3,4,9,All Good!,4.35,,
THANKS!