Live data from Hacker News

Feature comparison of ack, ag, git-grep, GNU grep and ripgrep

beyondgrep.com

31–40 of 101 posts

Re: Feature comparison of ack, ag, git-grep, GNU grep and ripgrep

#31
A nice feature of ag is the ability to limit the search to a certain file type. E.g. to only search ruby files: ag --ruby foo.

To see a list of supported types and the matching file extensions: ag --list-file-types.

Just checked and rg does have something similar, but you need to specify the type as an argument to a flag: rg --type ruby foo.

Re: Feature comparison of ack, ag, git-grep, GNU grep and ripgrep

#32

The chart was created by Andy Lester, the creator of ack, who thinks that more open source projects should point to their "competing" projects because it's not really a competition: http://blog.petdance.com/2018/01/02/the-best-open-source-pro...

Emphasis mine-

Excerpt: "Some might say that ag and ripgrep and any of the other tools I list on beyondgrep.com are competing projects, but I think that way of thinking is wrong. It’s only a competition if you see it as a competition. I’m not competing against anyone for anything: Clicks, dollars, popularity, etc. If someone uses ripgrep instead of ack, it doesn’t hurt me. It’s the difference between an abundance vs. scarcity view of the world. I choose abundance. I think most of us who work in open source do, too."

I never thought I would see the confluence of the "woo-woo" space abundance mindset and a blog post about an open source command-line utility. I must say I am intrigued.

If this explanatory medium doesn't substantiate the reasonability of a mindset of abundance in the minds of programmers, I don't know what ever will.

Re: Feature comparison of ack, ag, git-grep, GNU grep and ripgrep

#33

I’m stuck with rg right now because it’s the only ine which correctly handles gitignore files. Generally quite happy with it but I wish it could also use a more powerful regex engine for some less common cases. Most annoying thing is that $ does not work with windows newlines.

ack doesn't do git ignore right? The matrix suggests it does, and I thought it did, but I don't use it routinely.

It supports a subset but not a very good one. At least it fails to handle leading slashes.

Re: Feature comparison of ack, ag, git-grep, GNU grep and ripgrep

#34
post #22

The table is misleading isn't it? It seems to imply that rg can't work recursively, but [1] states "..ripgrep defaults to recursive directory search...". I understand that the table might mean that rg doesn't have a flag to enable recursive search, but surely we care about features more than flags... [1] https://github.com/BurntSushi/ripgrep#why-should-i-use-ripgr...

It's almost more useful as a rosetta stone than a feature comparison.

Re: Feature comparison of ack, ag, git-grep, GNU grep and ripgrep

#35
post #3

as a long time user of `find . -name "*.foo" -exec grep -Hin {} \;` moving to ack has been great! I love the syntax and the speed and the fact that it actually respects your ignore files. ripgrep is great too. ag on the other hand is recommended by everyone but doesn't seem to respect ignores or understand modern ignore syntax. give it a pass. https://github.com/ggreer/the_silver_searcher/issues/385 its been over 4 y…

At the least, I recommending moving past `find . --name '*.foo' -exec grep` pattern if you can help it. Modern file searchers, of which `ag` is one among others, accepts `--filenametype` argument and skips the `.git` subdirectory if it exists (by default, can be toggled), so `ag --python needle` will recursively search for needle in the the current working tree in all files whos filenames end in `.py`. Yes, you could…

Or just use "grep". It is what it's there for.

Use --include and --exclude-dirs to do what you describe. (The latter is a good idea to set in your GREP_OPTIONS, unless you actually search .git directories.)

Re: Feature comparison of ack, ag, git-grep, GNU grep and ripgrep

#36
post #22

The table is misleading isn't it? It seems to imply that rg can't work recursively, but [1] states "..ripgrep defaults to recursive directory search...". I understand that the table might mean that rg doesn't have a flag to enable recursive search, but surely we care about features more than flags... [1] https://github.com/BurntSushi/ripgrep#why-should-i-use-ripgr...

It's almost more useful as a rosetta stone than a feature comparison.

Author here. Yes, that's really what it is. I need to make one that's actually feature comparison more than phrasebook.

We're also working on a GNU grep vs. POSIX grep vs. BSD grep phrasebook.

Re: Feature comparison of ack, ag, git-grep, GNU grep and ripgrep

#37

I’m stuck with rg right now because it’s the only ine which correctly handles gitignore files. Generally quite happy with it but I wish it could also use a more powerful regex engine for some less common cases. Most annoying thing is that $ does not work with windows newlines.

ack doesn't do git ignore right? The matrix suggests it does, and I thought it did, but I don't use it routinely.

ack does not look in .gitignore files at all.

Re: Feature comparison of ack, ag, git-grep, GNU grep and ripgrep

#38

A nice feature of ag is the ability to limit the search to a certain file type. E.g. to only search ruby files: ag --ruby foo . To see a list of supported types and the matching file extensions: ag --list-file-types . Just checked and rg does have something similar, but you need to specify the type as an argument to a flag: rg --type ruby foo .

ack does the "limit by a certain filetype", and it also lets you define your own file types or extend existing ones. ag does not.
Post reply on HN