xsv icon indicating copy to clipboard operation
xsv copied to clipboard

Auto-detect delimiter

Open harrybiddle opened this issue 2 years ago • 0 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.

harrybiddle avatar Mar 18 '22 14:03 harrybiddle