Giter VIP home page Giter VIP logo

csview's Introduction

๐Ÿ“  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


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.

csview's People

Contributors

wfxr avatar dependabot[bot] avatar zhiburt avatar 0x5c avatar frisoft avatar bingoohuang avatar ritschwumm avatar znley avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.