- Notifications
You must be signed in to change notification settings - Fork17
📠 Pretty and fast csv viewer for cli with cjk/emoji support.
License
Apache-2.0, MIT licenses found
Licenses found
wfxr/csview
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A high performance csv viewer with cjk/emoji support.
- Small andfast (seebenchmarks below).
- Memory efficient.
- Correctly alignCJK and emoji characters.
- Support
tsv
and custom delimiters. - Support different styles, including markdown table.
$ cat example.csvYear,Make,Model,Description,Price1997,Ford,E350,"ac, abs, moon",3000.001999,Chevy,"Venture ""Extended Edition""","",4900.001999,Chevy,"Venture ""Extended Edition, Large""",,5000.001996,Jeep,Grand Cherokee,"MUST SELL! air, moon roof",4799.00$ csview example.csv┌──────┬───────┬───────────────────────────────────┬───────────────────────────┬─────────┐│ Year │ Make │ Model │ Description │ Price │├──────┼───────┼───────────────────────────────────┼───────────────────────────┼─────────┤│ 1997 │ Ford │ E350 │ ac, abs, moon │ 3000.00 ││ 1999 │ Chevy │ Venture "Extended Edition" │ │ 4900.00 ││ 1999 │ Chevy │ Venture "Extended Edition, Large" │ │ 5000.00 ││ 1996 │ Jeep │ Grand Cherokee │ MUST SELL! air, moon roof │ 4799.00 │└──────┴───────┴───────────────────────────────────┴───────────────────────────┴─────────┘$ head /etc/passwd | csview -H -d:┌────────────────────────┬───┬───────┬───────┬────────────────────────────┬─────────────────┐│ root │ x │ 0 │ 0 │ │ /root ││ bin │ x │ 1 │ 1 │ │ / ││ daemon │ x │ 2 │ 2 │ │ / ││ mail │ x │ 8 │ 12 │ │ /var/spool/mail ││ ftp │ x │ 14 │ 11 │ │ /srv/ftp ││ http │ x │ 33 │ 33 │ │ /srv/http ││ nobody │ x │ 65534 │ 65534 │ Nobody │ / ││ dbus │ x │ 81 │ 81 │ System Message Bus │ / ││ systemd-journal-remote │ x │ 981 │ 981 │ systemd Journal Remote │ / ││ systemd-network │ x │ 980 │ 980 │ systemd Network Management │ / │└────────────────────────┴───┴───────┴───────┴────────────────────────────┴─────────────────┘
Runcsview --help
to view detailed usage.
csview
is available in the Arch User Repository. To install it fromAUR:
yay -S csview
You can installcsview
with Homebrew:
brew install csview
csview
is available from the main pkgsrc Repositories. To install simply run
pkgin install csview
or, if you prefer to build from source usingpkgsrc on any of the supported platforms:
cd /usr/pkgsrc/textproc/csviewmake install
You can installcsview
withScoop:
scoop install csview
Pre-built versions ofcsview
for various architectures are available atGithub release page.
Note that you can try themusl
version (which is statically-linked) if runs into dependency related errors.
csview
is also published oncrates.io. If you have latest Rust toolchains installed you can usecargo
to install it from source:
cargo install --locked csview
If you want the latest version, clone this repository and runcargo build --release
.
- small.csv (10 rows, 4 cols, 695 bytes):
Tool | Command | Mean Time | Min Time | Memory |
---|---|---|---|---|
xsv | xsv table small.csv | 2.0ms | 1.8ms | 3.9mb |
csview | csview small.csv | 0.3ms | 0.1ms | 2.4mb |
column | column -s, -t small.csv | 1.3ms | 1.1ms | 2.4mb |
csvlook | csvlook small.csv | 148.1ms | 142.4ms | 27.3mb |
- medium.csv (10,000 rows, 10 cols, 624K bytes):
Tool | Command | Mean Time | Min Time | Memory |
---|---|---|---|---|
xsv | xsv table medium.csv | 0.031s | 0.029s | 4.4mb |
csview | csview medium.csv | 0.017s | 0.016s | 2.8mb |
column | column -s, -t small.csv | 0.052s | 0.050s | 9.9mb |
csvlook | csvlook medium.csv | 2.664s | 2.617s | 46.8mb |
large.csv
(1,000,000 rows, 10 cols, 61M bytes, generated by concatenatingmedium.csv 100 times):
Tool | Command | Mean Time | Min Time | Memory |
---|---|---|---|---|
xsv | xsv table large.csv | 2.912s | 2.820s | 4.4mb |
csview | csview large.csv | 1.686s | 1.665s | 2.8mb |
column | column -s, -t small.csv | 5.777s | 5.759s | 767.6mb |
csvlook | csvlook large.csv | 20.665s | 20.549s | 1105.7mb |
We already havexsv, why not contribute to it but build a new tool?
xsv
is great. But it's aimed for analyzing and manipulating csv data.csview
is designed for formatting and viewing. See also:xsv/issues/156
The file may use a non-UTF8 encoding. You can check the file encoding usingfile
command:
$ file -i a.csva.csv: application/csv; charset=iso-8859-1
And then convert it toutf8
:
$ iconv -f iso-8859-1 -t UTF8//TRANSLIT a.csv -o b.csv$ csview b.csv
Or do it in place:
$ iconv -f iso-8859-1 -t UTF8//TRANSLIT a.csv | csview
csview
is distributed under the terms of both the MIT License and the Apache License 2.0.
See theLICENSE-APACHE andLICENSE-MIT files for license details.
About
📠 Pretty and fast csv viewer for cli with cjk/emoji support.