4 ms·
'miller' and 'xsv' are pretty good tools for wrangling CSV. (And regexp is kind of a terrible tool for it, too many edge cases.)
by sk5t 5y ago
'miller' and 'xsv' are pretty good tools for wrangling CSV.
(And regexp is kind of a terrible tool for it, too many edge cases.)
- jrumbut 5y agoYeah, I don't want to have to write a CSV library each time, that's what I'm trying to get at. I just end up using Python/Perl but I do have a soft spot for awk so it would be cool if good support was built-in.
- sk5t 5y agoWho's writing a library? Just use xsv or miller to extract the bits you want from the CSV, change the delimiter or escapes to something more convenient, etc., then feed that to awk or other CSV-unaware text processors.
- jrumbut 5y agoI was agreeing with your point about regexes, that it's good to avoid trying to deal with all the corner cases yourself when you're just trying to write a small script.
- sk5t 5y agoAh, understood! CSV is funny, it seems like a more trivial thing than it really is, and its human readability sort of invites broken approaches in a way that something like Parquet would not. XML is somewhere in the middle--I've seen some horrible abuses of CDATA sections way back when--but at least there are accepted ways to prove what's invalid.