有人知道Linux/OS X的命令行CSV查看器吗?我在考虑一些更少的东西,但以一种更可读的方式分隔列。(我可以用OpenOffice Calc或Excel打开它,但这对于我需要查看的数据来说太强大了。)有水平和垂直滚动会很棒。


当前回答

XSV不仅仅是一个查看器。我推荐它用于命令行上的大多数CSV任务,特别是在处理大型数据集时。

其他回答

安装csvtool(在Ubuntu上)

sudo apt-get install csvtool

然后运行:

csvtool readable filename | view -

这将使它在只读的vim实例中非常漂亮,即使您有一些具有非常长的值的单元格。

如果你是一个vimmer,使用CSV插件,它非常漂亮:

.

Tabview:轻量级的python curses命令行CSV文件查看器(以及其他表格式python数据,如列表中的列表)在Github上

特点:

Python 2.7+, 3.x Unicode support Spreadsheet-like view for easily visualizing tabular data Vim-like navigation (h,j,k,l, g(top), G(bottom), 12G goto line 12, m - mark, ' - goto mark, etc.) Toggle persistent header row Dynamically resize column widths and gap Sort ascending or descending by any column. 'Natural' order sort for numeric values. Full-text search, n and p to cycle between search results 'Enter' to view the full cell contents Yank cell contents to clipboard F1 or ? for keybindings Can also use from python command line to visualize any tabular data (e.g. list-of-lists)

我为这些(和其他)目的创建了一个表。安装与

pip install tablign

and

$ cat test.csv
Header1,Header2,Header3
Pizza,Artichoke dip,Bob's Special of the Day
BLT,Ham on rye with the works,
$ tablign test.csv
Header1 , Header2                   , Header3
Pizza   , Artichoke dip             , Bob's Special of the Day
BLT     , Ham on rye with the works ,

如果数据由逗号以外的其他东西分隔,也适用。最重要的是,它保留了分隔符,因此您还可以使用它来设置ASCII表的样式,而不牺牲[Markdown,CSV,LaTeX]语法。

这里有一个(可能太)简单的选择:

sed "s/,/\t/g" filename.csv | less