1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-28 23:44:54 +02:00
tldr/pages/common/ack.md
Cameron Tod 038ea380fc
ack: add regex, single file search examples (#4007)
Co-authored-by: Zlatan Vasović <zlatanvasovic@gmail.com>
Co-authored-by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
2020-05-21 12:30:19 +01:00

32 lines
619 B
Markdown

# ack
> A search tool like grep, optimized for programmers.
> More information: <https://beyondgrep.com/documentation/>.
- Find files containing "foo":
`ack {{foo}}`
- Find files of a specific type:
`ack --ruby {{foo}}`
- Count the total number of matches for the term "foo":
`ack -ch {{foo}}`
- Show the file names containing "foo" and number of matches in each file:
`ack -cl {{foo}}`
- 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}}`
- List all valid types:
`ack --help=types`