7 ms·
One of my favorite idioms for searching for a string: find /path -type f |xargs grep blah Has been replaced by `ag` https://github.com/ggreer/the_silver_se
by lazyant 8y ago
One of my favorite idioms for searching for a string:
find /path -type f |xargs grep blah
Has been replaced by `ag` https://github.com/ggreer/the_silver_searcher https://github.com/ggreer/the_silver_searcher , ag is instant in a big repo compared to find|grep
- twalla 8y agoit's mentioned elsewhere in this thread but you should try ripgrep https://github.com/BurntSushi/ripgrep https://github.com/BurntSushi/ripgrep
- lazyant 8y agowill do, thanks !
- hwj 8y agoag has PCRE enabled by default. That's why I prefer it over ripgrep.
- burntsushi 8y agoYou might already know this, but the current release of ripgrep has support for PCRE2 (as opposed to PCRE1 in ag). All you need to do is pass the -P flag. If you want it enabled by default, then: echo -P > $HOME/.ripgreprc and add this to your .bashrc or equivalent: export RIPGREP_CONFIG_PATH="$HOME/.ripgreprc"
- cyphar 8y agoYes, though it should be noted that the reason it's faster is fewer command invocations and ignoring usually unwanted files (like .git/ and files listed in .gitignore). grep has a -R option which allows you to avoid the first problem, but avoiding the second one is a bit more difficult. Also there is ripgrep which I've heard is effectively a faster version of ag written in Rust.
- gray_-_wolf 8y ago> Also there is ripgrep which I've heard is effectively a faster version of ag written in Rust. I've tried it but had it crashing on me in some directories so I'm sticking with ag
- burntsushi 8y agoCan you file a bug report? Crashing is a serious bug, and I don't think one has been reported against ripgrep during a search for quite some time, so I'd be very keen on hearing about it.
- phiresky 8y agoI love how you always just instantly appear outta nowhere when someone mentions a problem with ripgrep or makes a false statement about it :)
- djmips 8y agomaybe he has scripts that grep for keywords on hacker news etc. :-)
- shaklee3 8y agoFor what it's worth, I use it extensively on several different platforms, and have never had a crash.
- gray_-_wolf 8y agoI will try to make it crash again, it's like half a year back so my memory is little fuzzy on where exactly it did happen.
- gray_-_wolf 8y agoWell, I did not find a crash (yet), but at least some deadlock (probably). https://github.com/BurntSushi/ripgrep/issues/1231 https://github.com/BurntSushi/ripgrep/issues/1231
- deleted 8y ago[deleted]