Questions tagged [ripgrep]

ripgrep (rg) is a line-oriented search tool, similar to grep or ack, that recursively searches your current directory for a regex pattern. Use this tag for questions about using ripgrep.

ripgrep is a line-oriented search tool that recursively searches your current directory for a regex pattern. By default, ripgrep will respect your .gitignore and automatically skip hidden files/directories and binary files. ripgrep has first class support on Windows, macOS and Linux, with binary downloads available for every release. ripgrep is similar to other popular search tools like The Silver Searcher, ack and grep.

User Guide

58 questions
0
votes
0 answers

Vim ripgrep searching for pipe symbol

Trying to search in vim using ripgrep :Rg for e.g. '||'. Have tried: :Rg --hidden --no-ignore '||' :Rg --hidden --no-ignore '\|\|' :Rg --hidden --no-ignore "||" :Rg --hidden --no-ignore "\|\|" But it just matches every column of every…
xxjjnn
  • 14,591
  • 19
  • 61
  • 94
0
votes
3 answers

How can I iterate from a list of source files and locate those files on my disk drive? I'm using FD and RIPGREP

I have a very long list of files stored in a text file (missing-files.txt) that I want to locate on my drive. These files are scattered in different folders in my drive. I want to get whatever closest available that can be…
Pennf0lio
  • 3,888
  • 8
  • 46
  • 70
0
votes
0 answers

How to search with wildcards with RIPGREP

I am failing at using wildcards for words when using ripgrep to find content in my files. Any help welcome. Specific case: looking for any word stargin with GHJA having any suffix such as GHJA129387 GHJA0938094, etc. (can be letters or numbers). I…
0
votes
0 answers

How do you find an overlapping match with a variable-length prefix using regex?

I am trying to match tags like TODO inside comments in some code files using a regular expression. Consider for example the following file: foo bar # TODO bar foo quux # TODO bar # TODO foo quux quux # foo ## TODO foo # bar # TODO quux '# TODO\''…
julianbetz
  • 59
  • 1
  • 3
0
votes
1 answer

How to get ripgrep to tell me which expressions from a list have no matches on the filesystem

For instance, say I have the list of strings that I want to search for: alfa bravo charlie delta nebuchadnezzar bartholomew and in my repo there are files that contain alfa, bravo, charlie and delta, but there are no files that contain…
Purplejacket
  • 1,808
  • 2
  • 25
  • 43
0
votes
1 answer

Piping ripgrep's output to Python for filtering (separate filename from match)

I need to use ripgrep to find a certain pattern. This will be a string describing a chemical reaction. The output of ripgrep looks something like this: ~ rg -U --only-matching --vimgrep --replace='$1' '```smiles\n(.+)\n```' Testing…
Thor Correia
  • 1,159
  • 1
  • 12
  • 20
0
votes
1 answer

Regex: is there a oneliner for this?

I want to search inside multiple big text files (200MB each) as fast as possible. I am using the command line tool ripgrep and I want to call it only once. In the following string: ***foo***bar***baz***foo***bar***baz (*** stands for a different…
maikelmeyers
  • 288
  • 3
  • 9
0
votes
1 answer

ripgrep from within vim's :term

I often use rg -i PATTERN | vim - to pipe the results to a new vim session. Is there a way to do this from within a running vim session with an open terminal (opened with :term) in a none blocking way? I know :vimgrep and it's already configured to…
vbd
  • 3,437
  • 4
  • 32
  • 45
0
votes
2 answers

Regex match all occurrences using back reference

I am trying to use back reference to match all occurrences of an imported class being instantiated using ripgrep with the --pcre2 option enabled. First I am looking to see if a class is being imported and then back referencing that to look up where…
securisec
  • 3,435
  • 6
  • 36
  • 63
0
votes
1 answer

ag and rg not listing files starting with underline, find does

If I do: touch _gandalf And then: rg --files | grep gandalf | wc -l or ag -l -g "" | grep gandalf | wc -l I get 0 matches as result. Now if I do a touch gandaf I get 1 match. Why is that? Does files starting with underline have a similar…
Jean Carlo Machado
  • 1,480
  • 1
  • 15
  • 25
-1
votes
1 answer

Grep summary with file name only once

I am trying to figure out a way to summarize the grep results and show results with filename once instead of every line. I know that ripgrep has this feature. I went through grep man page but couldnt find anything similar. I have a python script…
Red Gundu
  • 183
  • 2
  • 10
-1
votes
1 answer

How to use ripgrep in Ubuntu to search line in a CSV file

I have a csv file in my home directory as below cat…
Bogaso
  • 2,838
  • 3
  • 24
  • 54
-2
votes
1 answer

ripgreb: show search result between two hits

I'm very new to ripgreb, but very impressed by it. I have a very special triggy case that I was wondering if could be done Say I have two markdown files ... ## 5.9 Subheading plz, plz, plz do NOT find me! # 6 Heading ## 6.1 subheading plz, plz,…
Norfeldt
  • 8,272
  • 23
  • 96
  • 152
1 2 3
4