Questions tagged [ack]

ACK is a greplike tool optimized for programmers searching large heterogeneous trees of source code.

ACK 2 is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code. It runs in pure Perl, is highly portable, and runs on any platform that runs Perl.
Source official git page

37 questions
61
votes
9 answers

Search only in files that match a pattern with ack

Can ack search only through files that match a specific 'glob' pattern (eg: search for foo in all files named "bar*.c"). The command ack foo "bar*.c" only works in the current directory. Note: I know it's possible with find -exec: find . -name…
compie
  • 803
19
votes
3 answers

`ack` doesn't show line numbers on a single file

I'm using ack to search for a string. When I run it without a file argument, I get line numbers: $> ack function themes/README.txt 7:Drupal's sub-theme functionality to ensure easy maintenance and upgrades. sites/default/default.services.yml 48: …
user394
  • 14,404
  • 21
  • 67
  • 93
14
votes
2 answers

Search ALL files with ack

How can I search all files (including binary) in the current directory with ack v2? I want to do the same as doing ack 'foo' **, but just with a flag, so it works if I want to search all files in a specific directory without appending…
Tyilo
  • 5,981
4
votes
2 answers

How to search all text files in Ack? (with --text option being now removed)

Manual says that "The --text option has been removed.". It was setting the --type to text, i.e. ack was searching all text files regardless of their semantic category (i.e. in *.php files, *.txt files, *.cpp files, etc.). How to obtain this behavior…
3
votes
1 answer

Ignore files without extension in ack

I would like to define a file type that would enable me to ignore all files without extension in ack. In my .ackrc file I have added: --type-set=csv:ext:csv,tsv To handle CSV files that I often exclude from searches via --nocsv switch when running…
Konrad
  • 313
2
votes
1 answer

Can ack read patterns from a file?

grep can look for a list of patterns written in a file with grep -f patterns_file search_files Can ack read a list of patterns from a file?
lolesque
  • 301
0
votes
1 answer

Ack syntax for a file containing foo and bar

What's the ack syntax to find all files containing foo and also bar?
student
  • 18,305