News for hackers. Stuff that matters.
Re:Cheating at a company group activity using Unix tools by XorNot on Monday December 13, 2021 @07:04AM (#29538810)
I'd go further and say don't parse CSV with plaintext tools because it's barely a plaintext format. Use a CSV library and save yourself heartache when someone drops a quoted string in somewhere.
Re:Cheating at a company group activity using Unix tools by oblio on Monday December 13, 2021 @09:07AM (#29539661)
I don't understand why you're being downvoted.

Parsing CSV with simple text-oriented tools is bad of an idea as parsing HTML with regexps.

Re:Cheating at a company group activity using Unix tools by devenvdev on Monday December 13, 2021 @09:20AM (#29539764)
Most likely because it contradicts most people's experience, some CSVs can't be parsed with cli tools, but most of them can be, and it's much easier than writing code that does the same. So what the parent commenter says is true, just not pragmatic.
Re:Cheating at a company group activity using Unix tools by oblio on Monday December 13, 2021 @10:35AM (#29540490)
It is pragmatic with a minor tweak.

https://csvkit.readthedocs.io/en/latest/

https://github.com/BurntSushi/xsv

Heck, even sqlite has some stuff to help with processing CSV files: https://www.sqlite.org/csv.html

Re:Cheating at a company group activity using Unix tools by philwelch on Tuesday December 14, 2021 @04:59AM (#29550006)
csvkit and SQLite were always too slow whenever I tried to use them for this sort of thing. I don’t remember if I tried xsv. I do think I ended up converting most of my CSVs to TSV, or exporting them as TSV in the first place.
Re:Cheating at a company group activity using Unix tools by ryanianian on Monday December 13, 2021 @10:14AM (#29540271)
This isn't parsing CSV, it's generating it. That's not nearly as fraught.
Re:Cheating at a company group activity using Unix tools by philwelch on Tuesday December 14, 2021 @04:56AM (#29549988)
In my experience doing this kind of thing, I usually use TSV instead of CSV and end up using Unix tools anyway. None of the CSV tools keep up in terms of performance.