5

是否有将 csv 数据转换为 stackoverflow 友好表格的在线工具?类似于 mysql 在命令行上渲染结果。

2012-05-02,palani,My first comment
2012-05-02,raja,My second comment
2012-05-02,palani,My third comment
2012-05-03,raja,My fourth comment

非常友好

+-------------+-----------+----------------------+
| 2012-05-02  | palani    | My first comment     |
+-------------+-----------+----------------------+
| 2012-05-02  | raja      | My second comment    |
+-------------+-----------+----------------------+
| 2012-05-03  | palani    | My third comment     |
+-------------+-----------+----------------------+
| 2012-05-03  | raja      | My fourth comment    |
+-------------+-----------+----------------------+
4

7 回答 7

2

也许可以帮助你,即使它不是你正在寻找的东西。该工具是tsv(制表符分隔值)到 ascii 艺术表,所以现在您需要 csv2tsv 转换器。

于 2012-05-09T14:58:33.613 回答
2

使用米勒并运行

mlr --c2p cat input.csv

输出

2012-05-02 palani My first comment
2012-05-02 raja   My second comment
2012-05-02 palani My third comment
2012-05-03 raja   My fourth comment

或运行

mlr --c2p --barred cat input.csv

输出

+------------+--------+-------------------+
| 2012-05-02 | palani | My first comment  |
+------------+--------+-------------------+
| 2012-05-02 | raja   | My second comment |
| 2012-05-02 | palani | My third comment  |
| 2012-05-03 | raja   | My fourth comment |
+------------+--------+-------------------+

或者

mlr --c2p --implicit-csv-header --barred cat input.csv
+------------+--------+-------------------+
| 1          | 2      | 3                 |
+------------+--------+-------------------+
| 2012-05-02 | palani | My first comment  |
| 2012-05-02 | raja   | My second comment |
| 2012-05-02 | palani | My third comment  |
| 2012-05-03 | raja   | My fourth comment |
+------------+--------+-------------------+

或者

mlr --c2m --implicit-csv-header --barred cat input.csv
| 1 | 2 | 3 |
| --- | --- | --- |
| 2012-05-02 | palani | My first comment |
| 2012-05-02 | raja | My second comment |
| 2012-05-02 | palani | My third comment |
| 2012-05-03 | raja | My fourth comment |
1 2 3
2012-05-02 帕拉尼 我的第一条评论
2012-05-02 拉贾 我的第二条评论
2012-05-02 帕拉尼 我的第三条评论
2012-05-03 拉贾 我的第四条评论
于 2021-12-01T12:48:52.417 回答
1

我更喜欢这个工具来将逗号分隔值转换为文本表。您甚至可以设置线宽。对于高级用户,表格单元格宽度和对齐方式的控制非常简洁。

于 2013-03-07T01:10:25.113 回答
0

我在http://www.convertcsv.com/csv-to-flat-file.htm使用这个工具 它也处理列标题。单击“ASCII Table-ize it”框。

于 2013-11-05T19:07:28.323 回答
0

csvkit包括工具csvlook(以及csvformat):

输入

cat <<EOF | csvlook
2012-05-02,palani,My first comment
2012-05-02,raja,My second comment
2012-05-02,palani,My third comment
2012-05-03,raja,My fourth comment
EOF

输出

| 2012-05-02 | palani | My first comment  |
| ---------- | ------ | ----------------- |
| 2012-05-02 | raja   | My second comment |
| 2012-05-02 | palani | My third comment  |
| 2012-05-03 | raja   | My fourth comment |
于 2018-02-22T21:30:47.787 回答
0

还有另一个工具(YATG,Yet Another Table Generator)可以做到这一点,用python编写:

见:https ://github.com/10gic/yatg

将您的数据作为输入,这是输出(emacs 表格样式):

+------------+--------+-------------------+
| 2012-05-02 | palani | My first comment  |
+------------+--------+-------------------+
| 2012-05-02 | raja   | My second comment |
+------------+--------+-------------------+
| 2012-05-02 | palani | My third comment  |
+------------+--------+-------------------+
| 2012-05-03 | raja   | My fourth comment |
+------------+--------+-------------------+
于 2018-04-06T02:48:46.600 回答
0

强烈推荐一个在线工具:Convert CSV to ASCII Table

它是我最喜欢的表格格式转换工具,它可以将csv转换成不同的友好纯文本表格:

  1. ASCII 表(mysql 风格)
+─────────────+─────────+───────────────────+
| 2012-05-02  | palani  | My first comment  |
+─────────────+─────────+───────────────────+
| 2012-05-02  | raja    | My second comment |
+─────────────+─────────+───────────────────+
| 2012-05-02  | palani  | My third comment  |
+─────────────+─────────+───────────────────+
| 2012-05-03  | raja    | My fourth comment |
+─────────────+─────────+───────────────────+
  1. reStructuredText 网格表
+-------------+---------+-------------------+
| 2012-05-02  | palani  | My first comment  |
+=============+=========+===================+
| 2012-05-02  | raja    | My second comment |
+-------------+---------+-------------------+
| 2012-05-02  | palani  | My third comment  |
+-------------+---------+-------------------+
| 2012-05-03  | raja    | My fourth comment |
+-------------+---------+-------------------+
  1. Unicode 表(单行)
┌─────────────┬─────────┬───────────────────┐
| 2012-05-02  | palani  | My first comment  |
├─────────────┼─────────┼───────────────────┤
| 2012-05-02  | raja    | My second comment |
| 2012-05-02  | palani  | My third comment  |
| 2012-05-03  | raja    | My fourth comment |
└─────────────┴─────────┴───────────────────┘
  1. 统一码表
╔═════════════╦═════════╦═══════════════════╗
║ 2012-05-02  ║ palani  ║ My first comment  ║
╠═════════════╬═════════╬═══════════════════╣
║ 2012-05-02  ║ raja    ║ My second comment ║
║ 2012-05-02  ║ palani  ║ My third comment  ║
║ 2012-05-03  ║ raja    ║ My fourth comment ║
╚═════════════╩═════════╩═══════════════════╝

以及其他一些格式的纯文本 ASCII 表。您也可以输入“强制分隔行”来决定是否清楚地表达标题!

在此处输入图像描述

于 2021-12-01T12:14:34.317 回答