shenwei356 / csvtk

A cross-platform, efficient and practical CSV/TSV toolkit in Golang
http://bioinf.shenwei.me/csvtk
MIT License
999 stars 84 forks source link

printing number 1 "out of the blue" #232

Closed tompa911 closed 1 year ago

tompa911 commented 1 year ago

Prerequisites

Describe your issue

brew info csvtk ==> csvtk: stable 0.26.0 (bottled), HEAD

execute the following cat test.csv| csvtk pretty

output contains many unexpected lines containing only the number "1" which are not present in the input file test.csv

Thank you

I'm grateful to users who have greatly helped to report bugs and suggested new features.

I may respond to issues or fix bugs quickly, but I usually implement new features periodically (two or more weeks).

shenwei356 commented 1 year ago

Hi, The 1s is the last character 1 of wrapped sherlock51 (it would be more obvious with another output style -S grid).

+------------+-------+-----------+---------+------+--------+--------+-------------+
| 01/14/2022 | 66.94 | rajani2   | 6771653 | 0.88 | Black  | 468361 | Duncan      |
+------------+-------+-----------+---------+------+--------+--------+-------------+
| 01/13/2022 | 56.35 | sherlock5 | 9811354 | 0.75 | Black  | 467332 | Livermore   |
|            |       | 1         |         |      |        |        |             |
+------------+-------+-----------+---------+------+--------+--------+-------------+
| 01/12/2022 | 58.89 | dv4296    | 9811346 | 0.40 | Black  | 466596 | 7NT         |
+------------+-------+-----------+---------+------+--------+--------+-------------+

You can either set a biger -n or -W.

https://bioinf.shenwei.me/csvtk/usage/#pretty

 -n, --buf-rows int            the number of rows to determine the min and max widths (default 128)
 -W, --max-width int           max width
tompa911 commented 1 year ago

Very helpful, and quick answer. Thank you. I didn't realize that -n exited. This solves my problem. However ... I have the same processes running on macOS and Ubuntu Linux. csvtk on Linux is v0.24.0 It formats the output as expected, no wrapping, without using any flags. But that's OK. Just letting you know.

shenwei356 commented 1 year ago

csvtk on Linux is v0.24.0 It formats the output as expected, no wrapping, without using any flags.

Thanks for mentioning that. In v0.26.0, I reimplemented the pretty command, which wraps long cells by default.