Silversearcher: Difference between revisions

From wikinotes
 
No edit summary
Line 2: Line 2:
that searches more quickly than grep, and lets you perform
that searches more quickly than grep, and lets you perform
multiline regex.
multiline regex.
= Documentation =
<blockquote>
{| class="wikitable"
|-
| github || https://github.com/ggreer/the_silver_searcher
|-
|}
</blockquote><!-- documentation -->


= Install =
= Install =

Revision as of 16:22, 5 February 2024

The silver searcher is a file-searching module ag that searches more quickly than grep, and lets you perform multiline regex.

Documentation

github https://github.com/ggreer/the_silver_searcher

Install

sudo pacman -S the_silver_searcher  # arch
brew install the_silver_searcher    # macos

Usage

ag 'file.touch(\n\s.*)+'      # multiline search example

ag 'Foo(?!Bar)'               # lookahead/lookbehind!
ag '(?<=Foo)Bar'

ag --pager='less -Ri' search  # ag to pager

ag -G '.*\.rb$' foo             # search files matching '.*\.rb$' 

ag search \
  -l  `# print files only` \