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

csvcut -l -c1 picks a different column to csvcut -c1 #1145

Closed roaima closed 3 years ago

roaima commented 3 years ago

Consider the example data file, datafile

a,b,c
x,y,z

If I run csvcut to extract a column, I get a different column depending on whether or not I choose to add line numbers to the selection.

csvcut -c1 datafile
a
x

and contrast with

csvcut -c1 -l datafile
line_number,b
1,y

I can see nothing in the documentation that says I should count the inserted line number as a column, or that the first column of the source datafile becomes column zero when line numbers are selected, so I believe this may be a bug.

This particular version is from Cygwin, where csvcut --version reports csvcut 1.0.5.

jpmckinney commented 3 years ago

Thank you for reporting! It is fixed on GitHub.