When comparing Grep vs The Silver Searcher, the Slant community recommends The Silver Searcher for most people. In the question“What are the best command-line tools for searching plain-text data using regular expressions?” The Silver Searcher is ranked 1st while Grep is ranked 2nd. The most important reason people chose The Silver Searcher is:
The Silver Searcher is lightning fast.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Preinstalled on every Unix like system
Pro Searches any text file
Pro Reads from STDIN
You can search the output of any command just by piping into grep
.
Pro Searches multiple files
It is possible to instruct grep to search through multiple files specified on the command line or entire directory trees.
Pro Full PCRE regex support
Pro Fast
Searches through large collections of files well before the expected time.
Pro Speed
The Silver Searcher is lightning fast.
Pro Idiot proof
"ag searchterm" - it's that simple in its purest form.
Pro Support VCS ignore files
Ag can speed up by ignoring files matched by pattern in ".agignore" (deprecated), ".ignore" (since ag-v0.33.0), and VCS ignore files (.gitignore, .git/info/exclude, .hgignore, svn:ignore).
Pro Good overview of results
Grouped by file, highlighted with background color, linenumbers by default
Cons
Con Hard to filter by file type
Want to search for my_function in PHP files only? find . -name '*.php' -exec grep my_function '{}' ;
Con Multiple, not fully compatible, implementations
The most known 2 are: BSD and GNU implementations which slightly differ in their capabilities and performance.