Re:Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift ...
by hhda on Thursday November 30, 2023 @11:03AM
(#38475128)
Yeah, the -M command is wonderful (super handy for ignoring minified files that you don't want to see results from, etc), and also great is the -g command (eg `-g *.cs` and you'll just search in files that have the .cs extension).
Also the fact that it is a standalone portable executable can be super handy. Often when working on a new machine, I'll drop in the executable and an alias for grep that points to rg, so if muscle memory kicks in and I type grep it will still use rg.
Re:Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift ...
by 3PS on Thursday November 30, 2023 @11:48AM
(#38475714)
If you're a fan of the -g flag to ripgrep then I also recommend checking out the -t flag, short for --type, which lets you search specific file types. You can see the full list with `rg --type-list`. For example, you could just search .cs files with `rg -tcs`.
This flag is especially convenient if you want to search e.g. .yml and .yaml in one go, or .c and .h in one go, etc.
Re:Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift ...
by hhda on Thursday November 30, 2023 @12:36PM
(#38476342)
Thanks, I didn't know about `-t`, I'll read up on it.
Re:Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift ...
by kzrdude on Thursday November 30, 2023 @12:09PM
(#38475969)
-t is useful but -g doesn't require lookup in help first. Maybe the worse is better principle?
Random other helpful flag I use often is -M if any of the matches are way too long to read through and cause a lot of terminal chaos. Just add `-M 1000` or adjust the number for your needs and the really long matches will omit the text context in the results.