File this under #shell #functions I should have written years ago:

function grepc { #Do a grep -c, but skipping files with no results grep -c "$@" |grep -v ':0$' }

#unix #UnixShell #ShellScripting #bash #ksh

@rl_dane

Oh, didn't know about -c. I usually just pipe to wc -l I guess.

@amin

-c, -l, -h, -H, and -q are my favorite #grep flags. :D

Huh, that almost became a [Marcel Duchamp] reference. šŸ˜…

Marcel Duchamp - Wikipedia

@rl_dane

I just use -v and -E

@amin @rl_dane you guys use flags?... :p
@amin @rl_dane @sotolf You guys still use grep instead of ripgrep. Tst

@thedoctor @amin @sotolf

...and bash instead of zsh
...and grep/awk/sed instead of jq
...and firefox instead of chrome
...and the fediverse instead of facebook

Face it... I'm an unpopular-opinion neckbeard level boss. XD

cc: @mirabilos

@rl_dane Those are so not comparable!

@amin @sotolf @mirabilos

@thedoctor @rl_dane @amin @mirabilos At least bash and zsh is comparable to grep ripgrep, as zsh is just a strictly better bash ;)

@sotolf @thedoctor @rl_dane @mirabilos

Mm, not really though? ripgrep is meant for bulk grepping of files

@amin @thedoctor @rl_dane @mirabilos I think I had it installed, I just never remembered to use it :p

@sotolf @thedoctor @rl_dane @mirabilos

I mostly just use it to run rg TODO and see all the spots in a codebase I marked as still needing work.

@amin @sotolf @thedoctor @mirabilos

Why is ripgrep better than just grep -R?

@rl_dane @amin @sotolf @thedoctor @mirabilos it's somehow a lot faster if you want to grep a few GiB of code, like 15 minutes to 30 seconds

@kabel42 @amin @sotolf @thedoctor @mirabilos

Interesting! I wonder what kind of algorithmic optimizations (as opposed to compiler optimizations) they're using to do that, and if regular (GNU/BSD) grep could do the same.

Because I'll wear clown shoes and a tutu before changing to a "rewrite the world in rust!" utility šŸ˜‚

@rl_dane @amin @sotolf @thedoctor @mirabilos From what little i have read, some assumptions about what you are greping and different defaults. Doing the same in existing grep would probably break compatibility.
@kabel42 @rl_dane @amin @thedoctor @mirabilos Ah, so it's basically cheating, I mean, it does work, and I do it often when I create small tools, with the excuse that "It wasn't meant for that"
@sotolf @rl_dane @amin @thedoctor @mirabilos Is it cheating, if it is the second sentence in you README.md?
"ripgrep will respect gitignore rules and automatically skip hidden files/directories and binary files. (To disable all automatic filtering by default, use rg -uuu.)"
or, you didn't want to grep in .git anyway you are just too lazy to look up the flag to skip that
@kabel42 @rl_dane @amin @thedoctor @mirabilos All optimisation are just different ways of cheating ;)
@sotolf @rl_dane @amin @thedoctor @mirabilos doesn't cheating imply that you are dishonest about it?
@kabel42 @rl_dane @amin @thedoctor @mirabilos I don't know, it might be just that my mother-tongue's word for it "jukse" also has a connotation of taking the easy way out or a shortcut instead of doing the whole thing. And I transferred that over to english.
@sotolf @rl_dane @amin @thedoctor @mirabilos could be the same for German, where you have the choice of "Schummeln" and "Betrügen" :)

@kabel42 @rl_dane @amin @thedoctor @mirabilos Yeah, cheating as in Schummeln, not as in Betrügen.

I also saw now when looking the word up that it comes from german "juxen" which is "playing around, having fun" which is kind of a fun way that the word has been wandering :)

@sotolf @rl_dane @kabel42 @thedoctor @amin cheating can be Schummeln but I think it is usually somewhat more down the scale towards Betrügen, unless explicit in e.g. game
night context
@mirabilos @sotolf @rl_dane @thedoctor @amin
If using assumptions for optimization is cheating, is using Newtonian physics cheating?
@kabel42 @mirabilos @rl_dane @thedoctor @amin I mean, I cheat going to work each day, since I'm taking some shortcuts along the way :)

@sotolf @kabel42 @rl_dane @thedoctor @amin there’s meanings of to take a shortcut that aren’t related to cheating ;)

Consider a Venn diagram between both; they merely overlap, not subset.

@sotolf @kabel42 @rl_dane @thedoctor @amin … must … not … be … nerdsniped … to … make … Venn … diagram … between … terms … of … three … different … languages …

@mirabilos @sotolf @kabel42 @thedoctor @amin

lol do give in, I'd love to see how you create it. xfig? teX? ASCII art?

@rl_dane @sotolf @kabel42 @thedoctor @amin … probably Inkscape while constantly cursing.

@mirabilos @sotolf @kabel42 @thedoctor @amin

Sounds like me using GIMP 3.

Horrrrrid UI changes in GTK3. Horrid. Horrid.

@rl_dane @sotolf @kabel42 @thedoctor @amin that too, but Inkscape is just… Inkscape.

If I were a little better at SVG, I’d possibly use Inkscape’s XML window to write SVG as XML directly and just see it auto-updating the graphical representation, like some Tₑχ/LᓬTᓇΧ editors can.