Skip to content
Latchkey

qsv: A Fast CSV Toolkit for Pipelines

qsv is a fast, subcommand-based CSV toolkit (a maintained xsv fork) that slices, searches, joins, and summarizes CSV files without loading them into a database.

When you need to pick columns, filter rows, or summarize a big CSV in a pipeline, qsv is quicker than SQL and streams row by row. Each operation is a subcommand you can chain.

What it does

qsv exposes CSV operations as subcommands: select picks columns, search filters rows by regex, stats summarizes, join merges files, count counts rows, and slice takes a range. Subcommands compose over a pipe since each reads and writes CSV.

Common usage

Terminal
qsv select name,age users.csv
qsv search -s status 'fail' report.csv
qsv count report.csv
# summary statistics
qsv stats data.csv

Options

Subcommand / flagWhat it does
select <cols>Choose columns by name or 1-based index
search -s <col> <regex>Keep rows where a column matches a regex
statsColumn type, min, max, mean, cardinality
countPrint the number of data rows
-d <char>Input delimiter (e.g. -d "\t")
-n, --no-headersTreat the first row as data

In CI

Use qsv count to assert an export has the expected number of rows, or qsv search -s status fail | qsv count to fail when any row is failing. qsv streams, so it handles multi-GB CSVs without exhausting runner memory. Column selection is by header name, so it survives column reordering.

Common errors in CI

"CSV error: ... found record with N fields, but the previous record has M fields" means ragged rows; add --flexible or fix the source. "Selector name ... not found" from select/search means a wrong column name; run qsv headers file.csv to list them. A wrong delimiter parses the whole line as one field, so pass -d for TSV or semicolon-separated data.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →