Auto-detection of commas in column names
Author: llagerlofCreated Dec 14, 2015Updated Apr 10, 2025
I have this "people.csv" file:
id,name,age,gender
1,Lawrence,39,M
2,Oliver,25,M
3,Roberta,17,F
4,Bell,70,F
5,Dalek,12,M
6,Andrews,10,M
7,Marty,35,M
8,"Anna Lammas",40,F
9,"Marcos Vinicius",16,M
10,Lara,32,FIf I try to run the command below, an error is raised.
C:\test\q -H "select * from ./people.csv where gender = 'F'"
Bad header row: Header must contain only strings and not numbers or empty strings: 'id,name,age,gender'
'id,name,age,gender': Column name cannot contain commasHowever, this command works:
C:\test>q -H -d , "select * from ./people.csv where gender = 'F'"
3,Roberta,17,F
4,Bell,70,F
8,Anna Lammas,40,F
10,Lara,32,FWell, if a CSV file is, by default, comma separated, q should identify the first row as comma separated too, I think.
Thanks!
Source: harelba/q