Silversearcher

From wikinotes

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

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

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

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

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