2016-11-03 03:42:23 +00:00
|
|
|
# ripgrep
|
|
|
|
|
2019-10-09 16:50:48 +01:00
|
|
|
> A recursive line-oriented CLI search tool.
|
|
|
|
> Aims to be a faster alternative to `grep`.
|
2019-05-23 11:56:50 +01:00
|
|
|
> More information: <https://github.com/BurntSushi/ripgrep>.
|
2016-11-03 03:42:23 +00:00
|
|
|
|
|
|
|
- Recursively search the current directory for a regex pattern:
|
|
|
|
|
|
|
|
`rg {{pattern}}`
|
|
|
|
|
|
|
|
- Search for pattern including all .gitignored and hidden files:
|
|
|
|
|
|
|
|
`rg -uu {{pattern}}`
|
|
|
|
|
|
|
|
- Search for a pattern only in a certain filetype (e.g., html, css, etc.):
|
|
|
|
|
|
|
|
`rg -t {{filetype}} {{pattern}}`
|
|
|
|
|
|
|
|
- Search for a pattern only in a subset of directories:
|
|
|
|
|
|
|
|
`rg {{pattern}} {{set_of_subdirs}}`
|
|
|
|
|
|
|
|
- Search for a pattern in files matching a glob (e.g., `README.*`):
|
|
|
|
|
|
|
|
`rg {{pattern}} -g {{glob}}`
|
2018-09-06 14:46:53 +01:00
|
|
|
|
2019-11-04 09:54:16 +00:00
|
|
|
- Only list matched files (useful when piping to other commands):
|
2018-09-06 14:46:53 +01:00
|
|
|
|
|
|
|
`rg --files-with-matches {{pattern}}`
|
2018-12-08 12:01:13 +00:00
|
|
|
|
|
|
|
- Show lines that do not match the given pattern:
|
|
|
|
|
|
|
|
`rg --invert-match {{pattern}}`
|