2014-10-01 23:02:25 +01:00
|
|
|
# ack
|
|
|
|
|
|
|
|
> A search tool like grep, optimized for programmers.
|
2019-06-03 01:06:36 +01:00
|
|
|
> More information: <https://beyondgrep.com/documentation/>.
|
2014-10-01 23:02:25 +01:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Find files containing "foo":
|
2014-10-01 23:02:25 +01:00
|
|
|
|
|
|
|
`ack {{foo}}`
|
|
|
|
|
2019-03-07 08:23:13 +00:00
|
|
|
- Find files of a specific type:
|
2014-10-01 23:02:25 +01:00
|
|
|
|
2019-02-28 14:15:48 +00:00
|
|
|
`ack --ruby {{foo}}`
|
2014-10-01 23:02:25 +01:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Count the total number of matches for the term "foo":
|
2014-10-01 23:02:25 +01:00
|
|
|
|
|
|
|
`ack -ch {{foo}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Show the file names containing "foo" and number of matches in each file:
|
2014-10-01 23:02:25 +01:00
|
|
|
|
2015-10-28 08:33:06 +00:00
|
|
|
`ack -cl {{foo}}`
|
2019-03-07 08:23:13 +00:00
|
|
|
|
2020-05-11 09:57:08 +01:00
|
|
|
- Search a file for a specified string:
|
|
|
|
|
|
|
|
`ack bar "{{foo bar}}" {{path/to/file}}`
|
|
|
|
|
|
|
|
- Search a file for the specified regex pattern:
|
|
|
|
|
|
|
|
`ack bar "{{[bB]ar \d+}}" {{path/to/file}}`
|
|
|
|
|
2019-03-07 08:23:13 +00:00
|
|
|
- List all valid types:
|
|
|
|
|
2020-07-16 22:33:06 +01:00
|
|
|
`ack --help-types`
|