Interactively view, search & filter tabular data files using the csvlens engine. Apart from CSV and its dialects, Arrow, Avro/IPC, Parquet, JSON array & JSONL formats are supported with the "polars" feature.
Table of Contents | Source: src/cmd/lens.rs | 🐻❄️🖥️
Description | Examples | Usage | Lens Options | Common Options
Description ↩
Explore tabular data files interactively using the csvlens (https://github.com/YS-L/csvlens) engine.
If the polars feature is enabled, lens can browse tabular data in Arrow, Avro/IPC, Parquet, JSON (JSON Array) and JSONL files. It also automatically decompresses csv/tsv/tab/ssv files using the gz,zlib & zst compression formats (e.g. data.csv.gz, data.tsv.zlib, data.tab.gz & data.ssv.zst).
If the polars feature is not enabled, lens can only browse CSV dialects (CSV, TSV, Tab, SSV) and its snappy-compressed variants (CSV.sz, TSV.sz, Tab.sz & SSV.sz).
Press 'q' to exit. Press '?' for help.
Examples ↩
Automatically choose delimiter based on the file extension
qsv lens data.csv // comma-separatedqsv lens data.tsv // Tab-separatedqsv lens data.tab // Tab-separatedqsv lens data.ssv // Semicolon-separatedcustom delimiter
qsv lens --delimiter '|' data.csvAuto-decompresses several compression formats:
qsv lens data.csv.sz // Snappy-compressed CSVqsv lens data.tsv.sz // Snappy-compressed Tab-separatedadditional compression formats below require polars feature
qsv lens data.csv.gz // Gzipped CSVqsv lens data.tsv.zlib // Zlib-compressed Tab-separatedqsv lens data.tab.zst // Zstd-compressed Tab-separatedqsv lens data.ssv.zst // Zstd-compressed Semicolon-separatedExplore tabular data in other formats (if polars feature is enabled)
qsv lens data.parquet // Parquetqsv lens data.jsonl // JSON Linesqsv lens data.json // JSON - will only work with a JSON Arrayqsv lens data.avro // AvroPrompt the user to select a column to display. Once selected, exit with the value of the City column for the selected row sent to stdout
qsv lens --prompt 'Select City:' --echo-column 'City' data.csvOnly show rows that contain "NYPD"
qsv lens --filter NYPD data.csvShow rows that contain "nois" case insensitive (for noise, noisy, noisier, etc.)
qsv lens --filter nois --ignore-case data.csvFind and highlight matches in the data
qsv lens --find 'New York' data.csvFind and highlight cells that have all numeric values in a column.
qsv lens --find '^\d+$' data.csvUsage ↩
qsv lens [options] [<input>]
qsv lens --helpLens Options ↩
| Option | Type | Description | Default |
|---|---|---|---|
‑d,‑‑delimiter |
string | Delimiter character (comma by default) "auto" to auto-detect the delimiter | |
‑t,‑‑tab‑separated |
flag | Use tab separation. Shortcut for -d '\t' | |
‑‑no‑headers |
flag | Do not interpret the first row as headers | |
‑‑columns |
string | Use this regex to select columns to display by default. Example: "col1|col2|col3" to select columns "col1", "col2" and "col3" and also columns like "col1_1", "col22" and "col3-more". | |
‑‑filter |
string | Use this regex to filter rows to display by default. The regex is matched against each cell in every column. Example: "val1|val2" filters rows with any cells containing "val1", "val2" or text like "my_val1" or "val234". | |
‑‑find |
string | Use this regex to find and highlight matches by default. Automatically sets --monochrome to true so the matches are easier to see. The regex is matched against each cell in every column. Example: "val1|val2" highlights text containing "val1", "val2" or longer text like "val1_ok" or "val2_error". | |
‑i,‑‑ignore‑case |
flag | Searches ignore case. Ignored if any uppercase letters are present in the search string | |
‑f,‑‑freeze‑columns |
string | Freeze the first N columns | 1 |
‑m,‑‑monochrome |
flag | Disable color output | |
‑W,‑‑wrap‑mode |
string | Set the wrap mode for the output. | disabled |
‑A,‑‑auto‑reload |
flag | Automatically reload the data when the file changes. | |
‑S,‑‑streaming‑stdin |
flag | Enable streaming stdin (load input as it's being piped in) NOTE: This option only applies to stdin input. | |
‑P,‑‑prompt |
string | Set a custom prompt in the status bar. Normally paired w/ --echo-column: qsv lens --prompt 'Select City:' --echo-column 'City' Supports ANSI escape codes for colored or styled text. When using escape codes, ensure it's properly escaped. For example, in bash/zsh, the |
|
‑‑echo‑column |
string | Print the value of this column to stdout for the selected row | |
‑‑debug |
flag | Show stats for debugging |
Common Options ↩
| Option | Type | Description | Default |
|---|---|---|---|
‑h,‑‑help |
flag | Display this message |
Source: src/cmd/lens.rs
| Table of Contents | README