Ripgrep
From wikinotes
A faster alternative to grep.
Can also perform search/replace.
ripgrep is restricted to single-lines, and does not support lookahead/lookbehind.
If you need these features checkout universal code grep or silversearcher.
Documentation
official docs https://github.com/BurntSushi/ripgrep configuration docs https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#configuration-file
Locations
RIPGREP_CONFIG_PATH=${ANYWHERE}/.ripgreprc
optional config file ${ANYWHERE}/.rgignore
subdirectory specific ignore files
Tutorials
learnbyexample (cookbook) https://learnbyexample.github.io/substitution-with-ripgrep/
Usage
rg --pretty search | less -Ri # pipe rg to less rg -g '*.md' search # search files matching '*.md' for text 'email' rg -g '!*/test/*' search # exclude paths matching */test/* (-g can be used multiple times) rg -i search # case insensitive search rg -uuu search # ignore .gitignore, .ignore, ... # search files from rg rg 'search' $(rg -l other_search) # search files from `find` find . -type f -path '*/mutations/*.rb' -print0 \ | xargs -0 rg 'search'
Configuration
.ripgreprc
Any arguments you'd like to always be passed to ripgrep, dump in a ripgreprc.
This is not read automatically, you must point to it with the envvar$RIPGREP_CONFIG_PATH
.example
# ./.ripgreprc --sortr path