Home

Awesome

<h1 align="center">📠 csview</h1> <p align="center"> <em>A high performance csv viewer with cjk/emoji support.</em> </p> <p align="center"> <a href="https://github.com/wfxr/csview/actions?query=workflow%3ACICD"> <img src="https://github.com/wfxr/csview/workflows/CICD/badge.svg" alt="CICD"/> </a> <img src="https://img.shields.io/crates/l/csview.svg" alt="License"/> <a href="https://crates.io/crates/csview"> <img src="https://img.shields.io/crates/v/csview.svg?colorB=319e8c" alt="Version"> </a> <a href="https://github.com/wfxr/csview/releases"> <img src="https://img.shields.io/badge/platform-%20Linux%20|%20OSX%20|%20Win%20|%20ARM-orange.svg" alt="Platform"/> </a> </p> <img src="https://raw.githubusercontent.com/wfxr/i/master/csview-screenshot.png" />

Features

Usage

$ cat 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

$ 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 │ /               │
└────────────────────────┴───┴───────┴───────┴────────────────────────────┴─────────────────┘

Run csview --help to view detailed usage.

Installation

On Arch Linux

csview is available in the Arch User Repository. To install it from AUR:

yay -S csview

On macOS

You can install csview with Homebrew:

brew install csview

On NetBSD

csview is available from the main pkgsrc Repositories. To install simply run

pkgin install csview

or, if you prefer to build from source using pkgsrc on any of the supported platforms:

cd /usr/pkgsrc/textproc/csview
make install

On Windows

You can install csview with Scoop:

scoop install csview

From binaries

Pre-built versions of csview for various architectures are available at Github release page.

Note that you can try the musl version (which is statically-linked) if runs into dependency related errors.

From source

csview is also published on crates.io. If you have latest Rust toolchains installed you can use cargo to install it from source:

cargo install --locked csview

If you want the latest version, clone this repository and run cargo build --release.

Benchmark

ToolCommandMean TimeMin TimeMemory
xsvxsv table small.csv2.0ms1.8ms3.9mb
csviewcsview small.csv0.3ms0.1ms2.4mb
columncolumn -s, -t small.csv1.3ms1.1ms2.4mb
csvlookcsvlook small.csv148.1ms142.4ms27.3mb
ToolCommandMean TimeMin TimeMemory
xsvxsv table medium.csv0.031s0.029s4.4mb
csviewcsview medium.csv0.017s0.016s2.8mb
columncolumn -s, -t small.csv0.052s0.050s9.9mb
csvlookcsvlook medium.csv2.664s2.617s46.8mb
ToolCommandMean TimeMin TimeMemory
xsvxsv table large.csv2.912s2.820s4.4mb
csviewcsview large.csv1.686s1.665s2.8mb
columncolumn -s, -t small.csv5.777s5.759s767.6mb
csvlookcsvlook large.csv20.665s20.549s1105.7mb

F.A.Q.


We already have xsv, 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


I encountered UTF-8 related errors, how to solve it?

The file may use a non-UTF8 encoding. You can check the file encoding using file command:

$ file -i a.csv
a.csv: application/csv; charset=iso-8859-1

And then convert it to utf8:

$ 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

Credits

License

csview is distributed under the terms of both the MIT License and the Apache License 2.0.

See the LICENSE-APACHE and LICENSE-MIT files for license details.