3 ms·
Not exactly the same thing, but I often use a tiny tool I wrote called shellql[1] that lets you just type in SQL like cat foo.csv | shellql "select f1, cou
by ketralnis 11y ago
Not exactly the same thing, but I often use a tiny tool I wrote called shellql[1] that lets you just type in SQL like
cat foo.csv | shellql "select f1, count(*) from tbl where f2='thingiwant' group by f1 order by count(*) desc limit 5"
It has some limitations on the formats of CSV that it can take, namely that string fields have to be quoted, but you can see from the code that there's not much to it if you wanted to change that. It'd also be easy enough to take in multiple CSV files, join them together, etc.
sqlite's pretty badass.
[1] https://gist.github.com/ketralnis/8124b3ead9d94e00dcb2 https://gist.github.com/ketralnis/8124b3ead9d94e00dcb2