Questions tagged [ripgrep]
ripgrep is a line-oriented search tool that recursively searches your current directory for a regex pattern while respecting your gitignore rules. Also: rg
17 questions
0 votes
1 answer
582 views
using ripgrep with regex including literal dollar symbol
Suppose I have a script containing something like VAR=${VAR1%.*} I'm looking for a command along the lines of rg "${.*%" to find it, but I can't get anywhere near. all of these fail rg &...
0 votes
2 answers
48 views
List files where searched term occurs more than a Threshold
I have a command like rga --files-with-matches --count-matches --sort path -i -e "use cases?" -e "user stor(y|ies)" -e "Technical debt" -e "Code Quality" -e &...
6 votes
1 answer
1k views
How does pattern matching work in grep for accented characters (eg. á, è, ò)
What characters match the following regex : ^[a-zA-Z]$ Specifically, should characters with accents (eg. á, è, ò) match this regex? Or just 26 lower and upper case alphabets? I have tried to check ...
3 votes
5 answers
2k views
Recursive grep matching only specific line number
How can I can I find files that contain a specific pattern on a specific line number ? Let's assume I have a directory with a bunch of text files containing 3 lines, such as: Title A Category X ...
1 vote
2 answers
2k views
How to individually process each path from a list of paths output from ripgrep
I'm on Linux Ubuntu 18.04 and 20.04. Ripgrep (rg) can output a list of paths to files containing matches like this: # search only .txt files rg 'my pattern to match' -g '*.txt' -l # long form rg 'my ...
7 votes
3 answers
3k views
How to match a literal string containing an unclosed quote with ripgrep?
I have a file that contains the some python code. There is a line that contains the following(including the quotes) 'hello "value"' I want to search 'hello "value" in the file. ...
0 votes
2 answers
133 views
ripgrep type definition to skip tests
I would like to be able to run rg -Ttests instead of typing rg -g'!tests/' -g '!test/' -g'!Tests/' -g '!Test/' , is that possible?
36 votes
1 answer
24k views
How can I search a specific list of files with ripgrep?
I've got a list of files that I would like to search for a pattern with ripgrep. How can this be done?