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
My FOSS project CSVfix allows you to display CSV files in "ASCII art" table format.
Using TxtSushi you can do:
xsv is more than a viewer. I recommend it for most CSV task on the command line, especially when dealing with large datasets.
I've created tablign for these (and other) purposes. Install with
and
Also works if the data is separated by something else than commas. Most importantly, it preserves the delimiters so you can also use it to style your ASCII tables without sacrificing your [Markdown,CSV,LaTeX] syntax.
I used pisswillis's answer for a long time.
But then combined some code I found at http://chrisjean.com/2011/06/17/view-csv-data-from-the-command-line which works better for me:
The reason it works better for me is that it handles wide columns better.
I wrote a script, viewtab , in Groovy for just this purpose. You invoke it like:
It is basically a super-lightweight spreadsheet that can be invoked from the command line, handles CSV and tab separated files, can read VERY large files that Excel and Numbers choke on, and is very fast. It's not command-line in the sense of being text-only, but it is platform independent and will probably fit the bill for many people looking for a solution to the problem of quickly inspecting many or large CSV files while working in a command line environment.
The script and how to install it are described here:
http://bayesianconspiracy.blogspot.com/2012/06/quick-csvtab-file-viewer.html