News for hackers. Stuff that matters.
Re:Feature comparison of ack, ag, git-grep, GNU grep and rip... by fphilipe on Monday January 08, 2018 @11:13AM (#16097703)
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 rip... by petdance on Monday January 08, 2018 @11:46AM (#16097932)
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.
Re:Feature comparison of ack, ag, git-grep, GNU grep and rip... by okdana on Monday January 08, 2018 @12:16PM (#16098180)
You can shorten it with -t: -tc, -tphp, -truby, -tsh. Then it's actually the same amount of characters as with ag.
Re:Feature comparison of ack, ag, git-grep, GNU grep and rip... by masklinn on Monday January 08, 2018 @02:02PM (#16099043)
And has the advantage of being pluggable rather than a hard-coded list of file types (though IIRC ack has a configuration file whereas with rg you need to use an alias to set up new types for every invocation).
Re:Feature comparison of ack, ag, git-grep, GNU grep and rip... by petdance on Monday January 08, 2018 @02:38PM (#16099543)
ack has a configuration file, and it's extremely flexible, including the ability to check shebang lines. If you have a shell script without an extension, it's the only way to know what language it is.