3 ms·
> if the CSV is replaced by a zipped JSON doc then the benefits are the same. Being able to use things like jq and gron might make simple use cases extremely s
by dividedbyzero 3y ago
> if the CSV is replaced by a zipped JSON doc then the benefits are the same.
Being able to use things like jq and gron might make simple use cases extremely straightforward. I'm not aware of anything similarly nimble for CSV.
- two_handfuls 3y agoFor CSV? DuckDB, Datasette, awk, pawk, and tons of others.
- rewmie 3y ago> For CSV? DuckDB, Datasette, awk, pawk, and tons of others. Those tools are either line- or table-oriented, and thus don't handle CSVs as a structured format. For instance, is there any easy way to use AWK to handle a doc where one line has N columns but some lines have N+1, with a random column entered in an undetermined point?
- two_handfuls 3y agoThe CSV Spec (1) specifies that “Each line should contain the same number of fields throughout the file”, so what you describe would be a noncompliant file. Nevertheless, I would expect both awk and pawk to be able to work with it just fine. Both pawk and the recent version of awk can parse the CSV format correctly (not just splitting on commas, but also handling the quoting rules for example). 1: https://www.rfc-editor.org/rfc/rfc4180 https://www.rfc-editor.org/rfc/rfc4180
- BeefWellington 3y agocsvtool is probably what you're looking for, though I think the use case for JSON vs CSV is different as one is hierarchy-oriented and the other is flat.
- darkwater 3y agoYou dont gron with CSV, normal grep will work wonders.
- dividedbyzero 3y agogron gives you both the complete key and value in a single line (which you then grep). Directly grep-ing a specific column in a CSV file isn't very straightforward.