Anyone know of a command-line CSV viewer for Linux/OS X? I'm thinking of something like less
but that spaces out the columns in a more readable way. (I'd be fine with opening it with OpenOffice Calc or Excel, but that's way too overpowered for just looking at the data like I need to.) Having horizontal and vertical scrolling would be great.
相关问题
- Is shmid returned by shmget() unique across proces
- sqlyog export query result as csv
- how to get running process information in java?
- Xcode debugger displays incorrect values for varia
- Is there a way to report errors in Apple documenta
There's this short command line script in python: https://github.com/rgrp/csv2ascii/blob/master/csv2ascii.py
Just download and place in your path. Usage is like
Convert csv file at
csv-file-path
to ascii form returning the result on stdout. Ifcsv-file-path
= '-' then read from stdin.Options:
The nodejs package tecfu/tty-table can be globally installed to do precisely this:
It can also handle streams.
For more info, see the docs for terminal usage here.
Yet another multi-functional CSV (and not only) manipulation tool: Miller. From its own description, it is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON. (link to github repository: https://github.com/johnkerl/miller)
If you're a vimmer, use the CSV plugin, which is juuust beautiful.
You can install
csvtool
(on Ubuntu) viaand then run:
This will make it nice and pretty inside of a read-only vim instance, even if you have some cells with very long values.
I wrote this csv_view.sh to format CSVs from the command line, this reads the entire file to figure out the optimal width of each column (requires perl, assumes there are no commas in fields, also uses less):