[HN Gopher] Show HN: zfind - CLI like find but using SQL syntax ...
___________________________________________________________________
Show HN: zfind - CLI like find but using SQL syntax and also does
tar/zip
I wrote this because I needed to search a lot of files, including
some archives, for files in a date range but couldn't find any good
tools. Also I never liked find's option syntax. I think most
people already know SQL (or at least it's easier to learn) and a
much better match for this task.
Author : laktak
Score : 83 points
Date : 2024-06-05 08:19 UTC (14 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| berlinmonk wrote:
| Maybe you should take a look at fselect, that uses SQL dialect
| for search queries and supports archives (and much more).
|
| https://github.com/jhspetersson/fselect
| conkeisterdoor wrote:
| This looks awesome, I'm gonna play with this today. Thanks for
| the rec
| laktak wrote:
| tbh, I probably wouldn't have written zfind if I had known
| about this.
|
| fselect still takes the SQL analogy a bit too far for my taste,
| still cool though :)
|
| Oh and fselect doesn't do tar.
| threecheese wrote:
| Also tbh, I strongly prefer your query strategy; it doesn't
| require I remember an entire grammar, just a few keywords
| ('size' etc) which are probably at the top of your man page.
| If a replacement for 'find' - which annoys me because I have
| to dig through the man page anytime I do something
| nontrivial- forces me to dig through their man page to
| remember a grammar ... you catch my drift. Hope you keep
| keepin on, and thanks.
| mksybr wrote:
| If you're trying to replace find, please add something equivalent
| to find's -print0/-ls to feed it's output into xargs. Otherwise
| it may not work correctly on unusually named files (not that I've
| tried it yet).
|
| EDIT: seems to be a similar issue with fselect:
| https://github.com/jhspetersson/fselect/issues/150
| laktak wrote:
| Thanks, good point. I'll make sure to add it.
| neuthral wrote:
| great added this to my $PATH
|
| i make lots of custom bash file editing and this is gonna help
| mein the future
| mixmastamyk wrote:
| Neat, at first glance the -w option is almost required... this
| often means it should be bare args, skipping the option syntax.
| Maybe relax the mandatory quotes too? zfind
| ---csv size gt 20k and name = foo
| pastage wrote:
| This reminds me how much I love tcpdump it is one of the best
| domain specific languages I have seen on the command line.
| Having "and port 53" do the right thing is beautiful also
| without quotes.
| laktak wrote:
| The bare args are for the path(s) to search.
|
| zfind -w 'size>20k and name="foo"'
|
| I could consider having the first arg reserved for -w
|
| zfind 'size>20k and name="foo"'
|
| but I much prefer the quotes and being allowed to write >
| instead of gt.
| laktak wrote:
| also does 7zip and rar now
___________________________________________________________________
(page generated 2024-06-05 23:01 UTC)