1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-06-06 18:26:00 +02:00

ack: refresh (#5436)

This commit is contained in:
bl-ue 2021-03-24 19:50:01 -04:00 committed by GitHub
parent b6421d95e0
commit 045fee830c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,32 +1,37 @@
# ack # ack
> A search tool like grep, optimized for programmers. > A search tool like grep, optimized for developers.
> More information: <https://beyondgrep.com/documentation/>. > See also: `rg`, which is much faster.
> More information: <https://beyondgrep.com/documentation>.
- Find files containing "foo": - Search for files containing a string or regular expression in the current directory recursively:
`ack {{foo}}` `ack "{{search_pattern}}"`
- Find files of a specific type: - Search for a case-insensitive pattern:
`ack --ruby {{foo}}` `ack --ignore-case "{{search_pattern}}"`
- Count the total number of matches for the term "foo": - Search for lines matching a pattern, printing [o]nly the matched text and not the rest of the line:
`ack -ch {{foo}}` `ack -o "{{search_pattern}}"`
- Show the file names containing "foo" and number of matches in each file: - Limit search to files of a specific type:
`ack -cl {{foo}}` `ack --type={{ruby}} "{{search_pattern}}`
- Search a file for a specified string: - Do not search in files of a specific type:
`ack bar "{{foo bar}}" {{path/to/file}}` `ack --type=no{{ruby}} "{{search_pattern}}`
- Search a file for the specified regex pattern: - Count the total number of matches found:
`ack bar "{{[bB]ar \d+}}" {{path/to/file}}` `ack --count --no-filename "{{search_pattern}}"`
- List all valid types: - Print the file names and the number of matches for each file only:
`ack --count --files-with-matches "{{search_pattern}}"`
- List all values that can be used with `--type`:
`ack --help-types` `ack --help-types`