q

q

TLDR

Query .csv file by specifying the delimiter as ','

>_ q -d',' "SELECT * from [path/to/file]"
copy

Query .tsv file

>_ q -t "SELECT * from [path/to/file]"
copy

Query file with header row

>_ q -d[delimiter] -H "SELECT * from [path/to/file]"
copy

Read data from stdin; '-' in the query represents the data from stdin

>_ [output] | q "select * from -"
copy

Join two files (aliased as f1 and f2 in the example) on column c1, a common column

>_ q "SELECT * FROM [path/to/file] f1 JOIN [path/to/other_file] f2 ON (f1.c1 = f2.c1)"
copy

Format output using an output delimiter with an output header line (note: command will output column names based on the input file header or the column aliases overridden in the query)

>_ q -D[delimiter] -O "SELECT [column] as [alias] from [path/to/file]"
copy

Copied to clipboard
free 100$ digital ocean credit