• Stars
    star
    572
  • Rank 77,995 (Top 2 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ“  Pretty and fast csv viewer for cli with cjk/emoji support.

๐Ÿ“  csview

A high performance csv viewer with cjk/emoji support.

CICD License Version Platform

Features

  • Small and fast (see benchmarks below).
  • Memory efficient.
  • Correctly align CJK and emoji characters.
  • Support tsv and custom delimiters.
  • Support different styles, including markdown table.

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

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
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 concatenating medium.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

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


Things look weird if the width of table is more than the width of terminal window.

Use pager less with -S option: csview a.csv | less -S so you can scroll screen horizontally. Or use xsv to filter out the columns you don't care then piped to csview.


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.

More Repositories

1

forgit

๐Ÿ’ค A utility tool powered by fzf for using git interactively.
Shell
4,375
star
2

minimap.vim

๐Ÿ“ก Blazing fast minimap / scrollbar for vim, powered by code-minimap written in Rust.
Vim Script
1,195
star
3

code-minimap

๐Ÿ›ฐ A high performance code minimap render.
Rust
605
star
4

tmux-power

๐ŸŽจ Tmux powerline theme
Shell
526
star
5

tmux-fzf-url

๐Ÿš€ Quickly open urls on your terminal screen!
Shell
507
star
6

rlt

A universal load testing framework for Rust, with real-time tui support.
Rust
132
star
7

dotfiles

๐Ÿก My dotfiles
Shell
89
star
8

formarks

๐Ÿ”– Quickly navigate your work path!
Shell
48
star
9

xaj-hydrological-model

ๆ–ฐๅฎ‰ๆฑŸๆฐดๆ–‡ๆจกๅž‹Javaๅฎž็Žฐ
Java
31
star
10

emoji-cli

Ruby
21
star
11

tmux-net-speed

Shell
13
star
12

awesome-stars

A curated list of my GitHub stars!
12
star
13

estunnel

๐Ÿš› Tool for downloading data from elasticsearch cluster.
Rust
9
star
14

clitrans

Yet another command-line translator (Chinese ๐Ÿ”„ English).
Rust
9
star
15

protobuf.vim

Better vim syntax highlighting and indent plugin for Protobuf with grpc, grpc-gateway and grpc-swagger support.
Vim Script
7
star
16

advent-of-code-2021

๐Ÿฆ€ Rust solutions to AoC 2021
Rust
4
star
17

rustgrep

Rust
2
star
18

elastic-tunnel

Tools for downloading data from elasticsearch
Kotlin
2
star
19

tmux-web-reachable

Shell
2
star
20

epoch-cli

๐Ÿ•“ Epoch converter for CLI
Shell
1
star
21

metabase-druid-driver

Clojure
1
star
22

xaj-hydrological-model-demo

ๆ–ฐๅฎ‰ๆฑŸๆจกๅž‹็คบไพ‹
Java
1
star
23

idea-settings

1
star
24

geo-locator

A Kotlin & Java library for fast locating region by GPS coordinates.
Kotlin
1
star
25

vim-gitignore

Vim Script
1
star
26

awm.config

Lua
1
star
27

sort

A collection of sort algorithms
C
1
star
28

forepos

Shell
1
star
29

pbcopy

Just a xclip wrapper
Shell
1
star
30

producer-consumer-model

้€š่ฟ‡ๅคš็บฟ็จ‹ๅฎž็Žฐ็š„็”Ÿไบง่€…/ๆถˆ่ดน่€…ๆจกๅž‹
C++
1
star
31

pso-demo

Particle swarm optimization demo
Java
1
star
32

advent-of-code-2020

๐Ÿฆ€ Rust solutions to AoC 2020
Rust
1
star
33

pso

Particle swarm optimization Java implementation
Java
1
star