Live data from Hacker News

Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

blog.burntsushi.net

171–180 of 198 posts

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#172
post #169
post #38

What are the reasons for grep not being replaced/improved? This topic seems a bit old by now.

Honestly: I rely on my shell scripts working and any "grep replacement" has to work with all the old crusty shell scripts out there, likely including ones that use odd "quirks" and GNU options. If you want to innovate in this space, why sign up for all that? Invent a better wheel, and if people like it, they'll migrate over time. I remember using ag in the old days, and I use rg now. But there's things rg does by def…

Oh my heavens, I would never let ripgrep into POSIX. You can pry it out of my cold dead hands. :-)

> so I go back to old fashioned grep

If you do `rg -uuu` then it should search the same stuff grep will. Not sure if that's what you meant though.

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#173
Using Ripgrep via Consult [1] in Emacs is bliss. It's like the rg+fzf thing that some have made, but all inside Emacs. I use the `consult-ripgrep` command all the time, and sometimes I use it to make project-wide edits too! Workflow is search with `consult-ripgrep` -> export results to buffer -> edit buffer -> commit edits back to files. Details at [2] (includes video of me working it)

[1]: https://github.com/minad/consult#grep-and-find [2]: https://lambdaland.org/posts/2023-05-31_warp_factor_refactor...

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#174

One thing I wish ripgrep had is support for AND conditions.

That’s one of the reasons I made this actually https://github.com/boyter/cs

I wanted and boolean syntax mixed with fzf instant search. It’s not as fast as ripgrep of course but it’s not solving the same problem.

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#175
post #62

Earlier quoted context omitted.

I wrote a bash version of this: function frg { result=`rg --ignore-case --color=always --line-number --no-heading "$@" | fzf --ansi \ --color 'hl:-1:underline,hl+:-1:underline:reverse' \ --delimiter ':' \ --preview "bat --color=always {1} --theme='Solarized (light)' --highlight-line {2}" \ --preview-window 'up,60%,border-bottom,+{2}+3/3,~3'` file="${result%%:*}" linenumber=`echo "${result}" | cut -d: -f2` if [ ! -z "…

I've never really seen PowerShell beyond minimal commands, but after seeing the parent, I definitely think it has the superior syntax of the shells. Especially for scripts.

Unlike most Microsoft things it was not constrained by back compatibility.

I generally don't like MS software, but their commitment to back compatibility is worth calling out.

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#176
post #153

Earlier quoted context omitted.

> It also just doesn't feel like a quality product. On my work Windows laptop, Powershell will sometimes not quite bother flushing after it starts, so I get the banner text and then.. That’s independent of the shell, and is I believe a bug in the terminal emulator. There is an open source Windows Terminal you can separately install and that is so much better.

Nope, windows terminal definitely does this too. Just last week I was trying to install WSL, and thought it had frozen at 20% and was trying to figure out what went wrong ... turns out it had already booted but powershell had stopped flushing output.

[deleted]

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#177

Earlier quoted context omitted.

I've never really seen PowerShell beyond minimal commands, but after seeing the parent, I definitely think it has the superior syntax of the shells. Especially for scripts.

I expected to like Powershell when I began working somewhere with a lot of Windows (after decades of mostly Linux). I figured on paper this sounds like it has learned many important lessons that Unix shells could learn but (at least the popular ones) didn't, it's been given a blank canvas, the principles it's working to make sense, it has good people behind it. So I even undertook to write a modest new piece of glue…

> The syntax is clunky, it's really no better than popular Unix shells at being a "real" programming language...

YMMV (and obviously does). I think that powershell is night and day better than bash (etc) as a programming language.

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#178

Earlier quoted context omitted.

I expected to like Powershell when I began working somewhere with a lot of Windows (after decades of mostly Linux). I figured on paper this sounds like it has learned many important lessons that Unix shells could learn but (at least the popular ones) didn't, it's been given a blank canvas, the principles it's working to make sense, it has good people behind it. So I even undertook to write a modest new piece of glue…

I find the built-in commands rough. "curl https://jrock.us " to see if my website is up used to involve opening Internet Explorer to accept some sort of agreement. Now it just flashes the terminal, moves the cursor to the far right hand side of the screen, and blinks for a while. I like the Linux version of curl better...

Ironically, windows 10+ comes with real curl installed, to use it type curl.exe instead

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#179
post #135
post #92

Earlier quoted context omitted.

Even faster, I have an alias 'ss' (mnemonic for 'super search') for rg. Fitts' Law to the max!

What do you use a single "s" for?

git status --untracked-files=all

sn is 'git status --untracked-files=no'.

Re: Ripgrep is faster than grep, ag, Git grep, ucg, pt, sift (2016)

#180
post #36

I use ripgrep with the Emacs packages project.el (comes out of the box) and dumb-jump (needs to be installed). This may not be the most popular way of using rg but I have been very pleased with the overall experience. All it takes is running package-install to install the dumb-jump package and configuring the following hook: (add-hook 'xref-backend-functions #'dumb-jump-xref-activate) The Xref key sequences and comma…

this is a good option but i still use rg.el for the occasion that i want to search several projects at once or a subfolder within a project, where i would otherwise use ‘rgrep’
Post reply on HN