BurntSushi / xsv

A fast CSV command line toolkit written in Rust.
The Unlicense
10.29k stars 317 forks source link

[Suggestion] More resilient input handling #280

Closed hktonylee closed 2 years ago

hktonylee commented 2 years ago

I must say xsv is really useful tool! However I have one issue that some of my CSV files do not have enough fields. Let's say for this

col1,col2,col3
v1,v2
v3,v4
v5,v6

xsv will throw error CSV error: record 1 (line: 2, byte: 15): found record with 2 fields, but the previous record has 3 fields

My suggestion would be to throw warning instead, and still read the CSV as if the column is empty. This can help people to process some broken (and large) CSV file.

BurntSushi commented 2 years ago

Try the xsv fix-lengths command.

hktonylee commented 2 years ago

Thank you! This is a good solution :)

nezda commented 4 months ago

Now it's xsv fixlengths (no -)