1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 23:02:07 +02:00
tldr/pages/common/ag.md
Vitor Henrique 814e511bae
pages*: add missing mnemonics (part 1) (#12143)
* pages*: add missing mnemonics

---------

Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
Co-authored-by: Sebastiaan Speck <12570668+sebastiaanspeck@users.noreply.github.com>
2024-02-09 20:04:08 +05:30

733 B

ag

The Silver Searcher. Like ack, but aims to be faster. More information: https://github.com/ggreer/the_silver_searcher.

  • Find files containing "foo", and print the line matches in context:

ag {{foo}}

  • Find files containing "foo" in a specific directory:

ag {{foo}} {{path/to/directory}}

  • Find files containing "foo", but only [l]ist the filenames:

ag -l {{foo}}

  • Find files containing "FOO" case-[i]nsensitively, and print [o]nly the match, rather than the whole line:

ag -i -o {{FOO}}

  • Find "foo" in files with a name matching "bar":

ag {{foo}} -G {{bar}}

  • Find files whose contents match a regular expression:

ag '{{^ba(r|z)$}}'

  • Find files with a name matching "foo":

ag -g {{foo}}