Ripgrep: Difference between revisions
From wikinotes
(→Usage) |
No edit summary |
||
Line 51: | Line 51: | ||
</source> | </source> | ||
</blockquote><!-- usage --> | </blockquote><!-- usage --> | ||
= Configuration = | |||
<blockquote> | |||
== .ripgreprc == | |||
<blockquote> | |||
</blockquote><!-- .ripgreprc --> | |||
</blockquote><!-- Configuration --> |
Revision as of 17:41, 19 June 2022
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
Locations
${ANYWHERE}/.ripgreprc
subdirectory specific config ${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