Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tool to convert CSV data to stackoverflow friendly text only table?

Is there a online tool which converts csv data to stackoverflow friendly table? Similar to mysql rendering of results on command line.

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

to SO friendly

+-------------+-----------+----------------------+
| 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    |
+-------------+-----------+----------------------+
like image 350
palaniraja Avatar asked Oct 08 '22 21:10

palaniraja


2 Answers

Using Miller and running

mlr --c2p cat input.csv

output

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

or running

mlr --c2p --barred cat input.csv

output

+------------+--------+-------------------+
| 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 |
+------------+--------+-------------------+

or

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 |
+------------+--------+-------------------+

or

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 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
like image 161
aborruso Avatar answered Oct 12 '22 11:10

aborruso


Maybe this could help you even if it's not exacly what you are searching for. The tool is tsv (tab separated values) to ascii art table so now you need csv2tsv converter.

like image 42
core1024 Avatar answered Oct 12 '22 10:10

core1024