#cli

app csvlens

Command line csv viewer

19 releases

0.3.2 Oct 22, 2023
0.3.0 Jul 30, 2023
0.1.12 Feb 26, 2023
0.1.10 Dec 4, 2022
0.1.5 Mar 27, 2022

#121 in Command line utilities

Download history 44/week @ 2023-08-08 66/week @ 2023-08-15 48/week @ 2023-08-22 70/week @ 2023-08-29 54/week @ 2023-09-05 31/week @ 2023-09-12 38/week @ 2023-09-19 29/week @ 2023-09-26 33/week @ 2023-10-03 24/week @ 2023-10-10 69/week @ 2023-10-17 40/week @ 2023-10-24 57/week @ 2023-10-31 35/week @ 2023-11-07 75/week @ 2023-11-14 61/week @ 2023-11-21

234 downloads per month

MIT license

140KB
3.5K SLoC

csvlens

csvlens is a command line CSV file viewer. It is like less but made for CSV.

Demo

Usage

Run csvlens by providing the CSV filename:

csvlens <filename>

Pipe CSV data directly to csvlens:

<your commands producing some csv data> | csvlens

Key bindings

Key Action
hjkl (or ← ↓ ↑→ ) Scroll one row or column in the given direction
Ctrl + f (or Page Down) Scroll one window down
Ctrl + b (or Page Up) Scroll one window up
Ctrl + h (or Ctrl +) Scroll one window left
Ctrl + l (or Ctrl +) Scroll one window right
G (or End) Go to bottom
g (or Home) Go to top
<n>G Go to line n
/<regex> Find content matching regex and highlight matches
n (in Find mode) Jump to next result
N (in Find mode) Jump to previous result
&<regex> Filter rows using regex (show only matches)
*<regex> Filter columns using regex (show only matches)
TAB Toggle between row, column or cell selection modes
Enter (in Cell mode) Print the selected cell to stdout and exit
-S Toggle line wrapping
q Exit

Optional parameters

  • -d <delimiter>: Use this delimiter when parsing the CSV (e.g. csvlens file.csv -d $'\t').

    Specify -d auto to auto-detect the delimiter.

  • -i, --ignore-case: Ignore case when searching. This flag is ignored if any uppercase letters are present in the search string.

  • --echo-column <column_name>: Print the value of this column at the selected row to stdout on Enter key and then exit.

Installation

csvlens is available on crates.io, so you can install it using:

cargo install csvlens

Or, build and install from source:

cargo install --path $(pwd)

Linux package managers

csvlens is also available on pkgsrc. If you're using NetBSD you can install it using:

pkgin install csvlens

Dependencies

~7–18MB
~228K SLoC