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

learn more… | top users | synonyms

19
votes
7answers
8k views

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 ...
11
votes
2answers
2k views

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 ...
8
votes
2answers
7k views

How to do max-depth search in ack and grep?

Is there any way to tell ack to only search for text on the current folder? (or specify a max-depth level?) And with grep?
5
votes
3answers
597 views

`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 ...
4
votes
2answers
2k views

ack/grep search and sort by modification date

Is there any way to have ack sort the results found by date of modification? (ideally showing the date next to the result?). It doesn't look like ack has a date option, but just in case. If this isn'...
3
votes
2answers
173 views

Is there `find`'s `-exec` like option in `ack-grep`?

I want to remove all texts that include string foo. I can list all files by ack-grep foo, but I couldn't find a way to remove all files like -exec rm {} option like find. How can I delete all files ...
3
votes
2answers
117 views

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,...
3
votes
1answer
44 views

ack.pl tool and ack.pl flags

I am using the ack.pl tool in order to search string or IP’s in files The official site of ack.pl is - http://beyondgrep.com/documentation/ Example of ack.pl CLI ( want to find the string ...
2
votes
2answers
98 views

How do I ack-grep exclude file type *.sql files or file size larger than >3MB?

I want to search my directory for "foo" in the files, but i have these gigantic sql files. How do I exclude these file types or file sizes larger than 3MB using ack-grep? Also how would this be done ...
2
votes
1answer
36 views

How does this text reformatting happen with ack?

If I do a plain ack for a string, I get a line with the filename, and then the line numbers and the matching lines, like so: $> ack function mymodule.file 8: function myfunction1() { 16: public ...
2
votes
2answers
510 views

Web front-end to find/grep/ack

In my lab, we are trying to build a web that allows the user to enter queries for find, ack, grep on a specific directory. The web would return an HTML with a table of a list of clickable files (click ...
1
vote
2answers
393 views

Ack regex on filenames

According to this thread: Q: My understanding is that ack uses Perl-derivative regular expressions, is that correct? A: Yes. In fact, ack is written in Perl and just forwards the expressions ...
1
vote
2answers
353 views

Match a simple Regex

I need to match this: (tt\d{1,10}) in a file with the file ending txt. I have tried grep and ack-grep but without results. ack-grep -G \.txt$ -g "(tt\d{1,10})"
1
vote
1answer
35 views

Examine a bunch of huge files

I have a folder with big files (few GB each). I would like to search aPATTERNthrough these files. I can do this with grep or ack: $ grep -n 'PATTERN' /path/to/files/*.log Now, I have a list with ...
1
vote
3answers
68 views

How to pick out files in a folder in which the header contains specific text?

Use case: Let's say there is a folder full of large RDF+XML files and they follow different namespaces. We want to find those files that follow a given namespace (for example xmlns:crm="http://www....
1
vote
3answers
368 views

Installing ack on cpanel

I need to install ack on an instance of whm/cpanel (I have root access as it is a VPS) but I have not found any information on how to do that. I tried to install it using the WHM RPM manager, but the ...
1
vote
1answer
53 views

How do you install Ack-Grep on Red Hat Linux 6.5?

I'm not sure how to install ack-grep for redhat linux 6.5. Google only returned results on how to install it for mainly centos and ubuntu only. But what about Redhat? Why isn't there that many users ...
1
vote
1answer
27 views

ack executed through vim

I am trying to execute ack from vim. But for some reason vim decides to stop after executing ack. How can I stop vim from stopping? (on some systems what I call ack is called ack-grep) What I am ...
1
vote
2answers
221 views

Why can't I pipe to ack?

So I've been trying to use grep to extract some stuff from a Mercurial log and trying to avoid using awk just to see if I can get by without it here, and failing because neither grep nor egrep support ...
0
votes
2answers
84 views

How to search parenthesis by ack

I want to search for a parentheis ( using ack, but neither using ( nor \( worked. The first one ("(") is recognized as a multiple line command. The second one ("\(") is treated as an invalid regular ...