1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-08-22 04:23:56 +02:00

rg: add short options, simplify language (#16298)

Co-authored-by: Managor <42655600+Managor@users.noreply.github.com>
Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
This commit is contained in:
gsspdev 2025-05-02 22:33:02 -05:00 committed by GitHub
parent 36735f324a
commit aea2369b50
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,36 +2,36 @@
> Ripgrep, a recursive line-oriented search tool.
> Aims to be a faster alternative to `grep`.
> More information: <https://github.com/BurntSushi/ripgrep>.
> More information: <https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md>.
- Recursively search the current directory for a regular expression:
- Recursively search current directory for a pattern (regular expression):
`rg {{regular_expression}}`
`rg {{pattern}}`
- Search for regular expressions recursively in the current directory, including hidden files and files listed in `.gitignore`:
- Recursively search for a pattern in a file or directory:
`rg --no-ignore --hidden {{regular_expression}}`
`rg {{pattern}} {{path/to/directory}}`
- Search for a regular expression only in a subset of directories:
- Include hidden files and entries listed in `.gitignore`:
`rg {{regular_expression}} {{set_of_subdirs}}`
`rg {{[-.|--hidden]}} --no-ignore {{pattern}}`
- Search for a regular expression in files matching a glob (e.g. `README.*`):
- Only search the files whose names match the glob pattern(s) (e.g. `README.*`):
`rg {{regular_expression}} --glob {{glob}}`
`rg {{pattern}} {{[-g|--glob]}} {{filename_glob_pattern}}`
- Search for filenames that match a regular expression:
- Recursively list filenames in the current directory that match a pattern:
`rg --files | rg {{regular_expression}}`
`rg --files | rg {{pattern}}`
- Only list matched files (useful when piping to other commands):
`rg --files-with-matches {{regular_expression}}`
`rg {{[-l|--files-with-matches]}} {{pattern}}`
- Show lines that do not match the given regular expression:
- Show lines that do not match the pattern:
`rg --invert-match {{regular_expression}}`
`rg {{[-v|--invert-match]}} {{pattern}}`
- Search a literal string pattern:
- Search for a literal string pattern:
`rg --fixed-strings -- {{string}}`
`rg {{[-F|--fixed-strings]}} -- {{string}}`