Questions tagged [ack]

ack is a tool like grep, designed for programmers with large trees of heterogeneous source code.

ack is a tool like grep, designed for programmers with large trees of heterogeneous source code. http://beyondgrep.com

262 questions
28
votes
4 answers

How do I run programs with Strawberry Perl?

A coworker is trying to use ack (a Perl program) on his Windows machine, having tried it under Linux and decided he definitely wants to use it. He managed to get Strawberry Perl installed on his machine, but can't seem to figure out what to do to…
skiphoppy
  • 97,646
  • 72
  • 174
  • 218
28
votes
2 answers

Escaping a parenthesis in grep/ack

I want to look for the string "methodname(", but I am unable to escape the "(". How can I get grep methodname( * or ack-grep methodname( * to work?
YXD
  • 31,741
  • 15
  • 75
  • 115
27
votes
4 answers

ack: Exclude specific directories from search via regex

How do I ignore specific directories via RegEx with ack? I can use the --ignore-dir option, but this does not let me specify a RegEx. I want to be able to ignore any directory, which has the words test or tests or more complicated patterns in its…
cschol
  • 12,799
  • 11
  • 66
  • 80
24
votes
2 answers

Specify ignore custom file patterns in .ackrc

I have certain CSS files of fileName *-c.css and *-gen.css which I want to ignore from ack-grep searches. I see that --type-set=TYPENAME=.extension does not accept regex filters like *-c.css, any idea of how to get around this problem ?
22
votes
4 answers

ack-grep: chars escaping

My goal is to find all "
user80805
  • 6,088
  • 5
  • 28
  • 31
19
votes
1 answer

grep/ack -o with characters of context (not lines)

I'm trying to find a way to grep -o "somepattern" which gives me something like html/file.js 2:somepattern 5:somepattern but what would be really nice is to have a few characters (maybe 20) before and/or after that match. I know there is a way to…
tester
  • 22,441
  • 25
  • 88
  • 128
17
votes
4 answers

Searching multiple patterns (words) with ack?

I want to search multiple patterns in a directory containing recursive directories and files. I know command for grep which is as follows grep -e '(pattern1)|(pattern2)' or grep -r -E 'string1|string2|string3' /var/www/http What is the command…
Sandip Pingle
  • 647
  • 2
  • 14
  • 37
17
votes
2 answers

How can I show ack results and occurrence count

ack foo * returns a listing of lines: bar.txt 28: this is foo stuff dump.txt 12: results of foo gobs.txt 1137: more lines with foo and ack -c -l returns 3 My question is, how can I show both? I'd like the list of lines as in the first…
Chris
  • 871
  • 1
  • 10
  • 19
16
votes
1 answer

Ack with regex - Confusion with simple queries

I am trying to use ack-is-better-than-grep (ack) with regular expressions to find lines and snippets in my code repository. My understanding is that ack uses Perl-derivative regular expressions, is that correct? However, I am not sure how would…
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
15
votes
2 answers

What color options exist for ack(-grep) for colorization of output, logs, etc?

Where can one find a listing of all color combinations or such available to use with ack(-grep)? I find that passing logs through ack-grep can be quite helpful at detecting errors, warnings or various other conditions especially with colorization,…
ylluminate
  • 12,102
  • 17
  • 78
  • 152
15
votes
3 answers

Ack: Search directory tree for files with a particular extension

I basically just want to do ack foo *.citrus and have ack drill down and find the string 'foo' in all Citrus files in the current directory and below. The trouble is that this won't work if there aren't any Citrus files in the current directory. I…
Mark Wilden
  • 2,080
  • 1
  • 15
  • 15
15
votes
1 answer

How to use named regex groups in ack output?

Suppose I have a foo.txt file with the following content: [2010-11-13 12:00:02,656] [2010-11-13 12:00:02,701] [2010-11-13 12:00:02,902] When I ack for the date portion with the following, it works: ack "(?P\d{4}-\d{2}-\d{2})" foo.txt --output…
Stephen Chu
  • 153
  • 1
  • 4
15
votes
6 answers

Install ack-grep on CentOS

I went through fair amount of google search to install ack-grep on CentOS but I didn't find anything help. I also looked for the source codes but couldn't find it neither. Does anyone know how to install it on the OS? Thanks a lot.
novo
  • 356
  • 1
  • 6
  • 17
14
votes
4 answers

How can I escape the % and # characters in a Vim command?

I'm using Ack (https://github.com/mileszs/ack.vim) with the --literal flag to search through projects in Vim. I noticed that whenever I search for a string with the % or # characters, the search doesn't match things as I'd expect it to. I did some…
John Debs
  • 3,714
  • 2
  • 25
  • 35
13
votes
2 answers

How do I install ack on OS X (10.8.4)?

I am new to OS X and I am unable to figure out how to install ack. The instructions here didn't help, because the command "install" is failing. Please guide me proper commands. So far, I have downloaded ack 2.04 and placed it in the /usr/bin folder…
sgowd
  • 946
  • 3
  • 10
  • 27
1
2
3
17 18