2014-05-02 02:23:01 +01:00
|
|
|
# ag
|
|
|
|
|
|
|
|
> The Silver Searcher. Like ack, but faster.
|
|
|
|
|
2016-05-02 14:33:59 +01:00
|
|
|
- Find files containing "foo", and print the line matches in context:
|
2014-05-02 02:23:01 +01:00
|
|
|
|
2017-10-30 22:48:56 +00:00
|
|
|
`ag {{foo}}`
|
2014-05-02 02:23:01 +01:00
|
|
|
|
2016-05-02 14:33:59 +01:00
|
|
|
- Find files containing "foo", but only list the filenames:
|
2016-02-18 17:58:34 +00:00
|
|
|
|
2017-10-30 22:48:56 +00:00
|
|
|
`ag -l {{foo}}`
|
2016-05-02 14:33:59 +01:00
|
|
|
|
|
|
|
- Find files containing "FOO" case-insensitively, and print only the match, rather than the whole line:
|
|
|
|
|
2017-10-30 22:48:56 +00:00
|
|
|
`ag -i -o {{FOO}}`
|
2016-02-18 17:58:34 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Find "foo" in files with a name matching "bar":
|
2014-05-02 02:23:01 +01:00
|
|
|
|
2017-10-30 22:48:56 +00:00
|
|
|
`ag {{foo}} -G {{bar}}`
|
2014-05-02 02:23:01 +01:00
|
|
|
|
|
|
|
- Find files whose contents match a regular expression:
|
|
|
|
|
2017-10-31 21:41:52 +00:00
|
|
|
`ag '{{^ba(r|z)$}}'`
|
2014-05-02 02:23:01 +01:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Find files with a name matching "foo":
|
2014-05-02 02:23:01 +01:00
|
|
|
|
2017-10-30 22:48:56 +00:00
|
|
|
`ag -g {{foo}}`
|