1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-21 21:22:06 +02:00
tldr/pages/common/rg.md
bl-ue 8ebd171d6f
*: fix typos reported by Hunspell (#5848)
Co-authored-by: marchersimon <50295997+marchersimon@users.noreply.github.com>
Co-authored-by: Seth Falco <seth@falco.fun>
Co-authored-by: Patrice Denis <patricedenis@users.noreply.github.com>
2021-05-20 16:13:41 -04:00

1.1 KiB

rg

Ripgrep is a recursive line-oriented CLI search tool. Aims to be a faster alternative to grep. More information: https://github.com/BurntSushi/ripgrep.

  • Recursively search the current directory for a regular expression:

rg {{regular_expression}}

  • Search for regular expressions recursively in the current directory, including hidden files and files listed in .gitignore:

rg --no-ignore --hidden {{regular_expression}}

  • Search for a regular expression only in a certain filetype (e.g., html, css, etc.):

rg --type {{filetype}} {{regular_expression}}

  • Search for a regular expression only in a subset of directories:

rg {{regular_expression}} {{set_of_subdirs}}

  • Search for a regular expression in files matching a glob (e.g., README.*):

rg {{regular_expression}} --glob {{glob}}

  • Only list matched files (useful when piping to other commands):

rg --files-with-matches {{regular_expression}}

  • Show lines that do not match the given regular expression:

rg --invert-match {{regular_expression}}

  • Search a literal string pattern:

rg --fixed-strings -- {{string}}