BurntSushi / xsv

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

support unbalanced partitioning #327

Closed bmeck closed 1 year ago

bmeck commented 1 year ago

I have a bunch of streaming output I want to demultiplex and it would be incredibly easy to do so if xsv partition could work with unbalanced CSV rows:

$ cmd | tee foo.csv # generates multiple multiplexed csv dumps
a.csv,1
b.csv,2,3
$ xsv partition --filename '{}' 1 out ./foo.csv
CSV error: record 1 (line: 2, byte: 4): found record with 3 fields, but the previous record has 2 fields
BurntSushi commented 1 year ago

You need to apply xsv fixlengths first. Otherwise every command would need to have its own bespoke handling of CSV data with rows of varying length.