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
3
votes
2 answers

How to create Ctrl+f and ctrl+shift+f in vim?

I am learning vim recently as i have to use vim in some restricted machines. As i am a vscode user, I would like to find ctrl+f and ctrl+shift+f equivalent to do string search Ctrl+f will search within the file ctrl+shift+f will search in all the…
Samselvaprabu
  • 16,830
  • 32
  • 144
  • 230
3
votes
2 answers

How can I exclude lines containing a match found with Ripgrep?

I am using rg (or alternatively ag) to search for occurrences of a string in a folder with many files, like this: $ rg "cat" lolo 3:cat lala 2:cat Now I would like to get rid of these matches. How can I remove each line containing a match from…
TTT
  • 6,505
  • 10
  • 56
  • 82
3
votes
1 answer

Silversearcher/ack vs find,grep

Currently when I have to search for complex patterns in code, I typically use a combination of find and grep in the form: find / \( -type f -regextype posix-extended -regex '.*python3.*py' \) -exec grep -EliI '\b__[[:alnum:]]*_\b' {} \; -exec cat…
alpha_989
  • 4,882
  • 2
  • 37
  • 48
2
votes
1 answer

Telescope find files and live grep not work

I am trying to setup telescope with nvim on MacOS 13.2.1. I installed it using packer. I already installed all dependency that telescope needed. And still unable to show any result on find_files or live_grep search. Here my config in packer for…
2
votes
1 answer

How to use ripgrep to replace all matches within all files?

I can use the following command to print all changed file and content in the stdout rg --passthru -F "red" -r "green" -N Output: ip.txt blue test1 green 2 hello blue world ip2.txt blue test1 green 2 hello blue world ip3.txt green test1 green…
Owen Young
  • 157
  • 2
  • 8
2
votes
1 answer

Why ripgrep results from python subprocess run differ from rg run in the shell

If I run rg in bash directly, the output information includes the found file names (on a separate line), and then on a separate line for each match the line number and content for that match: 11:38 (main *+) durl $ rg format durl/__main__.py 35: …
nos
  • 19,875
  • 27
  • 98
  • 134
2
votes
1 answer

Node.js child process is not giving any response or any error

I am trying to use ripgrep in node.js application running on my mac machine. ( VS Code Extension). I tried ripgrep-js npm libray but it was not giving any response and application was just going to hang state. I tried to debug and found that…
2
votes
1 answer

python different output when run on bash and subprocess

I am running a script which internally calls a bash command and parses the output accordingly. For example i am calling this command result = subprocess.check_output("rg result",shell=True) print(output) I get this output without any line number or…
Red Gundu
  • 183
  • 2
  • 10
2
votes
0 answers

Hightlight line number with bat at fzf preview

I have a alias which when you pass a parameter will look like this rg --trim --no-heading test_based_image $HOME/ -n | fzf --color='preview-fg:110' --preview="cut -d":" -f1 <<< {} | xargs bat " The first part will return something…
b10n1k
  • 567
  • 5
  • 21
2
votes
1 answer

.gitignore node_modules/ not working for fd and ripgrep

I'm trying to setup fzf.vim for vim on windows 10. You can use an alternative find command like ripgrep or fd which is supposed to respect .gitignore. My .gitignore file has this line, which is working fine for git commits, etc.: node_modules/ My…
user210757
  • 6,996
  • 17
  • 66
  • 115
2
votes
1 answer

Rgrep in Emacs to use ripgrep

How can we customize Emacs' rgrep to use ripgrep (rg executable) -- making it working for searching in Latin 1, UTF-8 and UTF-16 at the same time? The idea is to reuse the standard rgrep command of Emacs, so that we can use next-error and…
user3341592
  • 1,419
  • 1
  • 17
  • 36
1
vote
2 answers

Multiline RegEx to match YAML Frontmatter, only the first match, only when preceded by nothing other than space

Problem The problem description is simple; I have a pile of text files, from which I wish to extract the frontmatter (described anon) alone, if it's there are all, and then stop processing the file any further. Here's a sample valid example of a…
khosrow
  • 8,799
  • 4
  • 21
  • 24
1
vote
1 answer

How can I configure ripgrep to always search from my home directory?

How can I configure my ~/.ripgreprc glob(s) to always search from the home directory regardless of where I run rg from?
lovelikelando
  • 7,593
  • 6
  • 32
  • 50
1
vote
1 answer

Counsel-rg omit long maching line

I utilize the counsel-rg to search the pattern of "~[a-z]+~", it displays the desired results but omit long matching line: How could enable it to get long-matching-line displayed?
AbstProcDo
  • 19,953
  • 19
  • 81
  • 138
1
vote
1 answer

Boosting the grep search using GNU parallel

I am using the following grep script to output all the unmatched patterns: grep -oFf patterns.txt large_strings.txt | grep -vFf - patterns.txt > unmatched_patterns.txt patterns file contains the following 12-characters long substrings (some…