Some AI coder: "I" wrote this new thing that searches for hidden strings in files.

Most youngins: Oh wow, that is so useful, I wish I had this years ago!

Us greybeards: Congratulations, you reinvented grep.

This is absolutely a subtoot.

Cue someone pointing out the code I am talking about may be running multithreaded and be faster than grep.....

Congratulations, you reinvented grep with xargs.

GitHub - BurntSushi/ripgrep: ripgrep recursively searches directories for a regex pattern while respecting your gitignore

ripgrep recursively searches directories for a regex pattern while respecting your gitignore - BurntSushi/ripgrep

GitHub
@nuintari or the multiple improved greps of antoquity
@nuintari
Or ugrep / ripgrep, which already existed for a long time too
GitHub - BurntSushi/ripgrep: ripgrep recursively searches directories for a regex pattern while respecting your gitignore

ripgrep recursively searches directories for a regex pattern while respecting your gitignore - BurntSushi/ripgrep

GitHub
@nuintari ooo how do u do that w xargs

@fiore Basically, read up on the -P option.

"Taco Bell Programming" is a good read, and has an example that'll get you started on the xargs rabbit hole.

http://widgetsandshit.com/teddziuba/2010/10/taco-bell-programming.html

Taco Bell Programming

@nuintari It's easy to forget that the average person probably only knows about grep -r for recursion and grep -e for regexps. And grep -f secrets.txt to load the secret patterns to match from a file, of course. Of course.
@m @nuintari I don't use those, but I remember the flags for inversion and case-insensitivity, or at least I remember that the flags exist and I can look them up in the man page if I need them.
@nuintari xargs is still serial though.
You reinvented ripgrep maybe. Or git grep

@StompyRobot

https://blogs.kenokivabe.com/article/multi-threaded-processing-using-xargs-and-parallel

decent place to start on the rabbit hole of how awesome xargs can be

Edit: I was on mobile when I found this link, and thus barely scanned it. It isn't actually all that great. Stick to the classics: Taco Bell Programming and then just dig into the man pages.

http://widgetsandshit.com/teddziuba/2010/10/taco-bell-programming.html

Multi-Threaded Processing Using xargs and Parallel - Keno Kivabe

@nuintari @StompyRobot ahh please not!
please don't tell people to `ls *.png | xargs…`; that's a recipe for unexpected delimiters-in-filenames disaster, and trivial to do better (`for f in *.png; do command "$f"; done`).
Especially annoying is the "basic" `find -criteria | xargs command` example, which can be safely and easily be handled by `find -criteria -exec 'command {}'`.
When piping filenames in `xargs` or `parallel`,at least make sure to use zero bytes as delimiters (e.g. `find -print0`)

@nuintari @StompyRobot with `parallel`, all the bad (really bad! What does the user want to happen when they `ls *.txt | parallel mv -t /mnt/backup`, and what does really happen in case there's zero .txt files?) examples of kind `ls *.png | parallel -opts cmd` should just be `parallel -opts cmd ::: *.png`

reading that article, it's honestly a bit like `parallel`'s man page or quick start tutorial didn't exist!

@nuintari @StompyRobot (quite frankly, that article is so full of popular really bad ideas that I think it's quite likely AI slop to a large amount, but I'm not quite sure. It certainly has a bit much personality for that, but both the reurgitation of long-discouraged patterns and the what-to-use-when table suggest AI slop)
@nuintari yeah, or ripgrep
@nuintari assuming i’m thinking of the same project, as far as i can tell the one thing it does that grep and alternatives don’t is automatically check various encodings of the search strings. (although it wouldn’t surprise me if this feature exists in some open source tool already or is replicable with pipes and subprocesses.)

@alys yeah, it's basically grep -f file-of-strings-and-encodings-to-seek

... with extra steps and shitty vibe coded python