wireservice / csvkit

A suite of utilities for converting to and working with CSV, the king of tabular file formats.
https://csvkit.readthedocs.io
MIT License
6.03k stars 603 forks source link

How to avoid that csvlook truncates the line? #1156

Closed jaswdr closed 2 years ago

jaswdr commented 2 years ago

Hello, I tried a bunch of flags, but csvlook seems to always truncate numeric values, is this expected?

What I tried

Sample CSV content

"1","2","3","4","5","6","7","8","9","10"
"","","","A","m",111111111,0.001111111111111111,11111111.333333333,"AAA","BB"
"","","","A","e",1111111111,1.11111111111,11111111.44444444,"AAAA","BB"
"","","","A","c",111111111,0.01111111111,11111111.666666666,"AAA","BB"

Command

$ cat sample.csv | csvlook --max-column-width 99999999999 --max-columns 99999999999 -z 99999999999
| 1 | 2 | 3 | 4 | 5 |             6 |      7 |               8 | 9    | 10 |
| - | - | - | - | - | ------------- | ------ | --------------- | ---- | -- |
|   |   |   | A | m |   111,111,111 | 0.001… | 11,111,111.333… | AAA  | BB |
|   |   |   | A | e | 1,111,111,111 | 1.111… | 11,111,111.444… | AAAA | BB |
|   |   |   | A | c |   111,111,111 | 0.011… | 11,111,111.667… | AAA  | BB |
|   |   |   |   |   |               |        |                 |      |    |

I expect that the columns 7 and 8 were not truncated and show the full value.

jpmckinney commented 2 years ago

Use a large value for --max-column-width along with --no-inference to avoid truncation.