BurntSushi / xsv

A fast CSV command line toolkit written in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto-detect delimiter

harrybiddle opened this issue · comments

Unfortunately, I am not in an environment where .csv files are always comma-separated and .tsv files are tab-separated. In my work I unfortunately frequently encounter semi-colon separated files.

It would be incredibly useful if xsv detected the delimiter for me. I tried to achieve this using a bash wrapper, but it was a bit fiddly because I need to do different things depending on whether xsv is being passed a file (in which case I sniff the file and then pass the delimiter to the xsv command) or a stream (in which case I sniff the stream, and then pass the amount I've already sniffed plus the rest of the stream to xsv).

My little hacky wrapper works (mostly!) but it would be much better implemented in xsv itself.

Possibly there could be an environment variable to set "auto-detect delimiter" as the default mode a-la #44.