#375·q

q 3.1.6 not working with usage examples

Author: areichowCreated Aug 18, 2026Updated Aug 18, 2026

I'm running Python 3.6.8 on RHEL 8.10, using q 3.1.6. I'm trying to do some queries on the output of ps, which led me to the website examples. The examples on the q site are throwing errors. I've tried What am I doing wrong?

~rev/qtest$ seq 1 1000000 > myfile.csv

~rev/qtest$ head myfile.csv
1
2
3
4
5
6
7
8
9
10

~rev/qtest$ q "select sum(c1),count(*) from myfile.csv where c1 % 3 = 0"
Bad header row: Header must contain only strings and not numbers or empty strings: '1'
'1': Column name must be a string

~rev/qtest$ q "select sum(c1) from myfile.csv"
Bad header row: Header must contain only strings and not numbers or empty strings: '1'
'1': Column name must be a string

~rev/qtest$ q "select c1 from myfile.csv"
Bad header row: Header must contain only strings and not numbers or empty strings: '1'
'1': Column name must be a string

~rev/qtest$ q "select * from myfile.csv"
Bad header row: Header must contain only strings and not numbers or empty strings: '1'
'1': Column name must be a string
~rev/qtest$ ps -ef | head -3
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 Jul22 ?        00:40:00 /usr/lib/systemd/systemd --switched-root --system --deserialize 18
root           2       0  0 Jul22 ?        00:00:02 [kthreadd]

~rev/qtest$ ps -ef | q -b -H "SELECT UID, COUNT(*) cnt FROM - GROUP BY UID ORDER BY cnt DESC LIMIT 3"
query error: no such column: UID
Warning - There seems to be a "no such column" error, and -H (header line) exists. Please make sure that you are using the column names from the header line and not the default (cXX) column names. Another issue might be that the file contains a BOM. Files that are encoded with UTF8 and contain a BOM can be read by specifying `-e utf-9-sig` in the command line. Support for non-UTF8 encoding will be provided in the future.

~rev/qtest$ ps -ef | q -b "SELECT UID, COUNT(*) cnt FROM - GROUP BY UID ORDER BY cnt DESC LIMIT 3"
query error: no such column: UID
Warning - There seems to be a "no such column" error, and -H (header line) exists. Please make sure that you are using the column names from the header line and not the default (cXX) column names. Another issue might be that the file contains a BOM. Files that are encoded with UTF8 and contain a BOM can be read by specifying `-e utf-9-sig` in the command line. Support for non-UTF8 encoding will be provided in the future.

~rev/qtest$ ps -ef | q -b "SELECT c1, COUNT(*) cnt FROM - GROUP BY c1 ORDER BY cnt DESC LIMIT 3"
query error: no such column: c1
Warning - There seems to be a "no such column" error, and -H (header line) exists. Please make sure that you are using the column names from the header line and not the default (cXX) column names. Another issue might be that the file contains a BOM. Files that are encoded with UTF8 and contain a BOM can be read by specifying `-e utf-9-sig` in the command line. Support for non-UTF8 encoding will be provided in the future.