4 ms·
> $ sqlite3 whois-log-copy.db "select source from queries"|sort|uniq|wc -l Oh cool they saved the logs in a database ! Wait... |sort|uniq|wc -l ?? But why ?
by lovasoa 2y ago
> $ sqlite3 whois-log-copy.db "select source from queries"|sort|uniq|wc -l
Oh cool they saved the logs in a database !
Wait... |sort|uniq|wc -l ??
But why ?
- SSLy 2y agobeats up re-re-remembering how to do it in sql
- radicality 2y agoAnd probably because for quick things like that you’re already working in a “pipeline”, where you first want to see some of the results so you output with SQLite, and then add more to the pipeline. Similarly, I often do ‘cat file | grep abc’ instead of just grep, might be probably out of habit.
- mr_mitm 2y agoI found that this is actually a good use case for LLMs. You can probably paste that one liner up there and ask it to create the corresponding SQL query.
- SSLy 2y agoyeah, they're good for cursed tools like that, ffmpeg, excel macros, etc etc
- mjevans 2y agoSELECT COUNT( DISTINCT source ) FROM queries ORDER BY source ASC -- COUNT ( DISTINCT ... ) ~= uniq | wc -l ;; sort without -u is this busybox? ORDER BY col ASC -- wait this doesn't need sort and uniq if it's just being counted... SELECT COUNT( DISTINCT source ) FROM queries
- Woovie 2y agobash nerds vs sql nerds I guess, these people are bash nerds
- lilyball 2y agoyeah, they could have done `sqlite …|sort -u|wc -l` instead and saved themselves a process invocation!
- silisili 2y agoHey now if you're just gonna count lines no need to sort it at all.