qsv cheat sheet

This post includes qsv commands you can use based on the qsv cheat sheet infographic from the wiki.

Many of these commands mention <path> which you should replace with the path to your CSV file.

Tip: If the output of a command is CSV data, pipe the command into qsv table for a (potentially) more readable format.

This post is based on qsv v3.2.0.

Row count

Return the total non-header row count.

qsv count <path>
  • To include the header row in the row count, add the -n flag.

Column count

Return the total column count.

qsv headers <path> --just-count

Statistics

Return statistical data for each column.

qsv stats <path>
  • To include more statistics (may take longer), add the -E flag.

Frequency

Return frequency data for each column.

qsv frequency <path>

Infer metadata

Return inferenced metadata.

qsv sniff <path>

Run a search query

Return rows that have a field which match the given regular expression.

qsv search <regex> <path>
  • To search by text instead of a regular expression, add the --literal flag and use a literal string instead of <regex>.

Return the first non-header rows

Return the first non-header rows. For example, we’ll return the first 100 non-header rows (replace 100 with the number of non-header rows you want).

qsv slice <path> -s 0 -e 100
  • To include the header row, add the -n flag.
  • To output in JSON format, add the --json flag.
  • To output to a file, add the -o <output-path> flag and replace <output-path> with the output path.