Reputation: 199
I have a BIG csv file and would like to load this data into my KDB table. The csv can be separated by comma (,) but I would like to avoid splitting values if comma is in double quotes.
Say if I have "CUSTOMER 1, CUST1" - This value should not split into 2 values, because the comma is inside double quotes.
I'm trying to spend some time googling around, but it didn't help much. I know it's fairly simple query but I'm newbie, any one there to guide me please?
Upvotes: 2
Views: 2344
Reputation: 1186
q should be smart enough to ignore what's between the quotation marks.
My CSV is as follows:
c1,c2
test,1
"CUSTOMER 1, CUST1",2
test,3
Once loaded, c1 is not split:
q)("*S";enlist ",") 0: `:tmp.csv
c1 c2
----------------------
"test" 1
"CUSTOMER 1, CUST1" 2
"test" 3
Upvotes: 1