💾 Archived View for idiomdrottning.org › mg captured on 2023-05-24 at 18:35:41. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
Kinda always thought it was weird that Unix didn’t have an app that could search for files where multiple patterns matched.
The patterns shouldn’t have to be on the same lines, but each term needs to be in the file.
This li’l twelve line Chicken Scheme program does just that.
git clone https://idiomdrottning.org/mg
I didn’t feel like implementing a buncha regex engines and stuff so I just shell out to rg -li, you can change that to ag, or traditional grep or awk or whatever you want before compiling.
This first version doesn’t have any options. The last argument is a directory of files (just use . if you want current directory, you’ve got to put something) and every other argument is a search pattern.
The last arg needs to be a directory and not a glob—that’ll get interpreted as if it were a search pattern.
Maybe in the future I’ll add some options handling and more awareness around paths and files to search in. This is just a quick li’l first^W second release.♥
Thanks to jcowan for writing in with the idea that instead of searching all the files once per term and lset-intersecting them, I could instead keep on narrowing the search. Obvi in hindsight and now implemented♥