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
1
vote
1 answer

Equivalent of a "mdfind" query in Ack: AND operator + -interpret switch

I am trying to modify Brett Terpstra's handy QuickQuestion script for my Linux machine. What would be Ack's equivalent to the following mdfind commands: mdfind -onlyin "$NOTESDIR" "filename:.$NOTESEXT AND filename:\"$NOTESPRE\" AND…
martz
  • 839
  • 6
  • 21
1
vote
1 answer

Is it possible to modify stdin for some daily commands?

Here is the feature I wanted. Every time I want to search something in my project directory. I use ack to search some keyword for me. ack hey And sometimes I want to search more than one word. So I type ack "hey there" I wish the double quote…
yeer
  • 482
  • 1
  • 4
  • 12
1
vote
2 answers

How to sync .ackrc and .gitignore_global?

I find that the file/directory types in my .gitignore_global (which changes fairly regularly) are typically those that I'd like to ignore in my ack searches. Is there a way to sync or "pipe" the the ignored files / directories from my…
user456584
  • 86,427
  • 15
  • 75
  • 107
1
vote
4 answers

How can I make ack search through a list of files listed in a text file?

I have foo.txt that contains a list of file names, delimited by newline. What I want to do is to use ack to search through the files listed in the foo.txt. How can I do that?
neilmarion
  • 2,372
  • 7
  • 21
  • 36
1
vote
1 answer

Find files where 2 given words occur in

(How) Can I find files where there are occurrences of 2 words in that same file, say Peter and James? Is it possible with ack-grep?
Bentley4
  • 10,678
  • 25
  • 83
  • 134
1
vote
1 answer

With ack (or something similar), how do I exclude sub-directories

For example: -- / ---- foo ------ exclude-me ---- bar ------ exclude-me ---- baz ------ exclude-me How could I search all foo, bar, and baz, BUT exclude any sub-directory with exclude-me?
Oscar Godson
  • 31,662
  • 41
  • 121
  • 201
1
vote
1 answer

ack ignore files matching a path in conjunction with positive path match

I want to do a command that searches all .js and .php files, but ignores paths with "Thirdparty/" and "data.js" in them. ack -il -G '(\.js|\.php)' 'my search string' I tried -v but it seems to inverse all -G operators, not just the preceeding…
chovy
  • 72,281
  • 52
  • 227
  • 295
1
vote
1 answer

How do you configure grep to act more like ack?

How would you get grep to exclude the files that ack excludes (temp files and version control directories) without typing out the exclude patterns? As described here, you could use GREP_OPTIONS, but then you run into the problems here: scripts that…
idbrii
  • 10,975
  • 5
  • 66
  • 107
1
vote
2 answers

ack search for content within Smarty TPL template files

Is it possible to use ack to search for content within Smarty template files (.tpl)? At the moment I can only search within the cached version of these templates, which themselves are PHP files. If I do a case-insensitive ack search like this below…
crmpicco
  • 16,605
  • 26
  • 134
  • 210
1
vote
1 answer

Perl regular expression, seeking SKU number

I'm trying to parse through a bunch of PHP code using ack. I'm pretty inexperienced with regular expressions and trying to figure out why what I'm using currently won't work as I expect. I am trying to find all lines in PHP files that match a…
ZenLikeThat
  • 2,052
  • 3
  • 16
  • 23
1
vote
4 answers

Vim and ack-grep: quickfix not opening files

I'm at a loss. I'm running Debian Lenny, vim 7.3, and I've tried both ack-grep 1.80 and 1.96. I added this line to my .vimrc: let g:ackprg="ack-grep -H --nocolor --nogroup" [When I include --column I get an error that it is not a valid option,…
todd.pierzina
  • 740
  • 4
  • 10
1
vote
1 answer

finding selectors by specific css values with ack/grep regex

I have the following two selectors in my css, laid out with this formatting: // file1.css #myId { margin-right:0; color:#f00; } // file2.css #otherId { margin-right:0; color: #f00 } My goal is to obtain the selector and the color value…
tester
  • 22,441
  • 25
  • 88
  • 128
1
vote
1 answer

Ack "unmatched ( in regex" error

I am really confused by this: I am trying to ack for all calls to a JavaScript function hideSideBar(arg1, arg2, etc..) in my project. Because it can optionally be called with no arguments, I started by just looking for instances of hideSideBar( ack…
Matt H.
  • 10,438
  • 9
  • 45
  • 62
0
votes
3 answers

Ignoring characters in search with ack

I am using ack to search for instances of the PHP function "split(" that has now been deprecated. Unfortunately, it is bringing up instances of preg_split (which is still valid), how can I ignore these results, whilst still searching for "split("?…
crmpicco
  • 16,605
  • 26
  • 134
  • 210