TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

244 点作者 infodroid超过 7 年前

21 条评论

infodroid超过 7 年前
The chart was created by Andy Lester, the creator of ack, who thinks that more open source projects should point to their &quot;competing&quot; projects because it&#x27;s not really a competition: <a href="http:&#x2F;&#x2F;blog.petdance.com&#x2F;2018&#x2F;01&#x2F;02&#x2F;the-best-open-source-project-for-someone-might-not-be-yours-and-thats-ok&#x2F;" rel="nofollow">http:&#x2F;&#x2F;blog.petdance.com&#x2F;2018&#x2F;01&#x2F;02&#x2F;the-best-open-source-pro...</a>
评论 #16097712 未加载
评论 #16098769 未加载
rozim超过 7 年前
The table is misleading isn&#x27;t it? It seems to imply that rg can&#x27;t work recursively, but [1] states &quot;..ripgrep defaults to recursive directory search...&quot;. I understand that the table might mean that rg doesn&#x27;t have a flag to enable recursive search, but surely we care about features more than flags...<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;BurntSushi&#x2F;ripgrep#why-should-i-use-ripgrep" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;BurntSushi&#x2F;ripgrep#why-should-i-use-ripgr...</a>
评论 #16097529 未加载
评论 #16097860 未加载
评论 #16097638 未加载
zellyn超过 7 年前
Here to plug using `--passthru`&#x2F;`--passthrough`: it will print all lines, but highlight matches. I often do things like this to watch an output log, but highlight all entries with the string PLUGH in them:<p><pre><code> tail -F output.log | ag --passthrough &#x27;.*PLUGH.*&#x27;</code></pre>
评论 #16098132 未加载
评论 #16097983 未加载
评论 #16098275 未加载
memco超过 7 年前
Seems pretty comprehensive. One confusing thing I found was these two: &quot;Don&#x27;t respect ignore files (.gitignore, .ignore, etc)&quot; vs &quot;Skip rules found in VCS ignore files (.gitignore, .hgignore, etc)&quot;<p>Aren&#x27;t those the same thing? Shouldn&#x27;t they be grouped for better comparison?
the_mitsuhiko超过 7 年前
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.<p>Most annoying thing is that $ does not work with windows newlines.
评论 #16098346 未加载
评论 #16097628 未加载
markild超过 7 年前
Not exactly sure what it is, but I really like this presentation format.<p>Thank you, have been trying to motivate myself to switch to ack&#x2F;ag for a while. This seems like it might be what I needed.
评论 #16097402 未加载
评论 #16097241 未加载
arca_vorago超过 7 年前
The one thing I wish more of these comparison tables had was licensing info, so for those like me who are curious:<p>1. GNU grep - GPLv3+<p>2. ack - Artistic License v2.0<p>3. ag (aka silver searcher) - Apache License 2.0<p>4. git-grep - GPlv2+&#x2F;LGPLv2.1+<p>5. rg - MIT license<p>So with maybe the exception of rg, all are gpl compatible, that&#x27;s great news.
评论 #16102544 未加载
评论 #16188062 未加载
fphilipe超过 7 年前
A nice feature of ag is the ability to limit the search to a certain file type. E.g. to only search ruby files: <i>ag --ruby foo</i>.<p>To see a list of supported types and the matching file extensions: <i>ag --list-file-types</i>.<p>Just checked and rg does have something similar, but you need to specify the type as an argument to a flag: <i>rg --type ruby foo</i>.
评论 #16097932 未加载
评论 #16098180 未加载
adamnemecek超过 7 年前
This chart doesn&#x27;t compare speed. Until rg, I didn&#x27;t grep much because I generally search through a lot of files. rg cuts through them in no time.
评论 #16097993 未加载
评论 #16098331 未加载
mbroshi超过 7 年前
Nice feature-level comparison.<p>Don&#x27;t know how you&#x27;d pull it off in the current tabular format, but would be great to include some of the UX side of things: For example, I use rg almost exclusively because it has an easy-to remember syntax (`rg search-string` is a recursive search), attractively colored and well-organized output, and seems much faster compared to other tools in my use cases.
nothrows超过 7 年前
as a long time user of `find . -name &quot;*.foo&quot; -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&#x27;t seem to respect ignores or understand modern ignore syntax. give it a pass.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;ggreer&#x2F;the_silver_searcher&#x2F;issues&#x2F;385" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ggreer&#x2F;the_silver_searcher&#x2F;issues&#x2F;385</a><p>its been over 4 years... its had its chance.
评论 #16097309 未加载
评论 #16097555 未加载
评论 #16097227 未加载
satish-setty超过 7 年前
Seems everybody here has switched to rg but I haven&#x27;t because it&#x27;s not available in Debian repos (yet) unlike ack&#x2F;ag. So, do such folks use Arch or just download a pre-built binary ? How about updating rg when a new version is out ?
评论 #16099347 未加载
评论 #16100530 未加载
coldtea超过 7 年前
rg for the win. It&#x27;s not some huge improvement, but it&#x27;s more of a feeling that things just work by default (similar to what I get from tmux vs screen).
评论 #16097358 未加载
petre超过 7 年前
Ack and ag use Perl&#x2F;PCRE so they&#x27;re more useful than grep&#x2F;rg if you know Perl style regular expressions.
评论 #16098327 未加载
dh-g超过 7 年前
switched from ag to rg a few months ago and have nothing but good things to say about the experience.
评论 #16097308 未加载
评论 #16097284 未加载
评论 #16097281 未加载
visarga超过 7 年前
Any modern tools like this?<p>sary - a suffix array library and tools <a href="http:&#x2F;&#x2F;sary.sourceforge.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;sary.sourceforge.net&#x2F;</a><p>It finds words in O(log(n)) time by using an additional index.
评论 #16099080 未加载
masklinn超过 7 年前
&gt; No descending into subdirectories<p>&gt; Limit directory search depth<p>These could be the same item, the former is a special case of the latter.
akerro超过 7 年前
The table somehow missed MIT grep.
caio1982超过 7 年前
What has always amazed me is how super fast ack is in my use cases.
hashkb超过 7 年前
I&#x27;ve been using pt for a few years... am I dumb or do I have a secret?
评论 #16102563 未加载
iameli超过 7 年前
Missing `git grep --name-only`
评论 #16106457 未加载