Questions tagged [ack]

ack is a grep-like utility that allows searching using Perl-like regular expressions instead of the ed-like regular expressions from grep.

Note: On Debian systems and derivatives like Ubuntu it's called ack-grep due to a naming conflict with a Kanji-related tool which is named ack, too.

38 questions
29
votes
1 answer

Limiting silver-searcher to only search specific file types

I'm doing ag "active_record" ., but I want to only care about .rb files. How do I limit what file types it searches on the command line?
24
votes
2 answers

ack-grep show the matched files name only. Do not show the matched content

I'm searching some keywords among minified files. It doesn't make sense to show those minified content. How could I use ack-grep 'SEARCH_WORD' and show the matched file names only
poc
  • 724
  • 1
  • 8
  • 15
18
votes
4 answers

How to use ack to search for file name

I have started using ack which is much faster than grep. However using ack I want to search for file name rather than file contents. Is there a way to do that?
Nadal
  • 979
17
votes
3 answers

Adding file type to ack permanently

I've recently learned how to let ack support more filetypes (adding the following to .ackrc): --type-add latte=.latte Unfortunately, that produces an info line on every ack search I use, even ones with 0 results. $ ack --latte dump ack: --type-add:…
15
votes
3 answers

Is there a command in Mac OS X that can perform multiline regex searching?

I want to do a simple regex search recursively through a directory that isn't restricted to single lines. I tried grep and ack, but neither seem to support this. I know it shouldn't be too computationally expensive (in my case) because my text…
Dan Tao
  • 1,109
13
votes
1 answer

Breadth-first search with ack or grep

When I search e.g. my home directory with ack (or grep), I normally want to know where I set a specific option. Since most config files are really close to ~ it would considerably speed up ack if I could search breadth-first. Is this possible?
Profpatsch
  • 437
  • 4
  • 13
13
votes
1 answer

Ack/Ag/Pt just list files?

For a Unix/Unix-like OS... So, I know I can just use find . to list all of the files recursively from the current folder. This includes files I am not interested in. Using Ack, Ag (silver searcher), or Pt (platinum searcher), is there a way to do…
aikeru
  • 253
11
votes
2 answers

How do I map --f to run Ack plugin in Vim?

I'm new to vim and I'm trying to map a key combo for running the Ack plugin found here: https://github.com/mileszs/ack.vim I want to map cmd-shift-f to run the Ack command :Ack. I've added the following to ~/.vimrc nmap :Ack It doesn't…
jordelver
  • 2,361
8
votes
3 answers

grin, ack and rak comparison

Having used ack for some time now, I find it much better for my development purposes than grep. But then I've heard about rak and grin. Has anyone used all three of them and can provide a comparison?
sumek
  • 717
7
votes
2 answers

How do you ack for a file that contains two or more phrases/words?

How do you use ack to search for a file that contains, for example, cat dog mouse anywhere in the file? Each phrase occur at least once in the file. This is kind of like the behavior of an online search engine. Bonus: Can we use regex on those…
hobbes3
  • 1,041
  • 5
  • 14
  • 22
6
votes
2 answers

Show line number when search a single file

ack usually shows line numbers with file name, $ ack searchme filename 1:searchme but it doesn't when search a single file, $ ack searchme filename searchme It's easy to show line numbers with grep $ grep -n searchme filename 1:searchme Can I…
6
votes
2 answers

Macports install of ack doesn't create correct executable

I am trying to install p5-app-ack port from Mac Ports, but it seems it doesn't create a /opt/local/bin/ack binary at the end: $ sudo port search *app-ack Password: p5-app-ack @1.960.0 (perl) A grep replacement that ignores .svn/CVS/blib…
qazwsx
  • 9,311
5
votes
1 answer

Using Ack.vim's quickwindow in vim

I am using ack.vim with vim. I get my search results back in a vim quickwindow which is great. Only problem is that I have to hit [enter] to open the file that's displaying in the quickwindow. On thee ack.vim github site it says In the quickfix…
frow
  • 51
  • 2
4
votes
3 answers

Gnu parallel and ack not playing nicely due to stdin, pipe

I'm trying to use parallel and ack together to do some searching in parallel. However, ack seems to insist on using stdin if it finds itself in a pipe, even if you give it files to search: $ echo hello > test.txt $ ack hello test.txt hello $ echo…
mgalgs
  • 2,472
4
votes
1 answer

Why doesn't ack recursively search all files by default?

From everything I can read ack-grep foo should search through all files in the current directory and subdirectories for the term "foo". However, the closest I can get is ack-grep foo * Which returns all results that have "foo" in the current…
theicfire
  • 293
1
2 3