Searches using ripgrep. Examples below tested on rigpgrep 0.4.0
.
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
- if pattern lowercase, then case insensitive
- recursive
- filenames as headers
- line numbers
- ignore binary files
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