Skip to content

Latest commit

 

History

History
58 lines (51 loc) · 1.46 KB

ripgrep.md

File metadata and controls

58 lines (51 loc) · 1.46 KB

rg

Searches using ripgrep. Examples below tested on rigpgrep 0.4.0.

Windows

Quotes
Within the Windows command prompt, quoting must be done using double quotes -- "*.sas".

UNC paths
To search within a UNC network path, the easiest method is to first cd into the directory. One may either map the drive manually or use the pushd command to automatically map the drive and cd into it.

pushd \\some\network\path\dir

Defaults

  • if pattern lowercase, then case insensitive
  • recursive
  • filenames as headers
  • line numbers
  • ignore binary files

Search examples

search context: within files
options: specific extension

rg --type-add "sas:*.sas" -tsas "proc means"



search context: within files
options: specific extension, redirect stdout to file

rg --heading --line-number --type-add "sas:*.sas" -tsas "proc means" > proc_means_search_results.txt



search context: filenames
options: specific extension

rg --type-add "sas:*.sas" -tsas --files



search context: filenames
options: glob

rg -g "*proposal*" --files



search context: filenames
options: specific extension, glob

rg -g "*final*" --files --type-add "prez: *.{pdf,pptx}" -tprez