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
2
votes
3 answers

Shell Script: How to copy files with specific string from big corpus

I have a small bug and don't know how to solve it. I want to copy files from a big folder with many files, where the files contain a specific string. For this I use grep, ack or (in this example) ag. When I'm inside the folder it matches without…
Rainflow
  • 121
  • 1
  • 8
2
votes
2 answers

grep/ack on Mac OS X finding multiple strings and respecting file types

I would like to run grep on Mac OS X that would meeting the following criteria: search all files with *.R or *.r as extension and ignore other files Find strings: wordA and wordB accounting for the fact that the strings may appear in the format…
Konrad
  • 17,740
  • 16
  • 106
  • 167
2
votes
2 answers

ack(ack-grep) to ignore nested-directories

i have ubuntu 14.04. and using ack-grep 2.12 to search for a text in files recursively inside a directory I want to setup ack-grep options specific to the directory ~/workspace/project/ so that when i am at path ~/workspace/project and do ack…
codeofnode
  • 18,169
  • 29
  • 85
  • 142
2
votes
2 answers

cron job - ack: command not found

I have a bash script that I've written to identify if a certain string exists in a file or not and then output the file name to "hasString.txt" of "noString.txt". I'm using ack -i 'mystring' 'searchDir' to find what I'm looking for. The weird thing…
I Dabble
  • 321
  • 2
  • 11
2
votes
1 answer

Regex to find magic numbers excluding comments for code written in C++

I'm trying to find magic numbers in a C++ codebase using ack. In this case, my guess is that most magic numbers will be those not immediately preceded by a letter or an underscore. That probably sounds broad, but I'd rather cast too wide a net. …
Ryan M
  • 647
  • 2
  • 6
  • 16
2
votes
1 answer

Vim Ack opens first file in current buffer

When i use Ack in vim (eg. :Ack "INSERT INTO") it opens the first file with a result in the current buffer. Is there a way to disable this, so I can browse the results before I open the file? I'm using gVim 7.4 and follow this Ack Repository:…
DalekSall
  • 385
  • 1
  • 2
  • 12
2
votes
1 answer

How to include .go for search for Ack in VIM?

Here is my .vimrc for Ack, But it can't search .go files, I'd like add .go support. let g:ackprg="ack-grep -H --nocolor --nogroup --column" function! Ack(args) let grepprg_bak=&grepprg exec "set grepprg=" . g:ackprg execute "silent! grep " .…
Cynial
  • 680
  • 8
  • 23
2
votes
2 answers

How can I find strings that have mixed cased with Perl?

I'm trying to filter thousands of files, looking for those which contain string constants with mixed case. Such strings can be embedded in whitespace, but may not contain whitespace themselves. So the following (containing UC chars) are matches: " …
Don Wakefield
  • 8,693
  • 3
  • 36
  • 54
2
votes
2 answers

Different regex output for grep, ack and rubular

I wanted to test this (<\/?)+[a-z]+(>) regex against different tools to see what I would get. Actually the purpose of the experiment was to test how each of the utility displayed results back to console. Basically it searches the below html document…
tawheed
  • 5,565
  • 9
  • 36
  • 63
2
votes
1 answer

Ignore a specific file in ack 2.0 to avoid Permission Denied error

I have a file that causes Ack 2.0 to report a "Permission denied" error, so I've been trying to get it to ignore the file. I have tried the following in my ackrc --type-set=lockfile:match:/NameOfLockfile/ --type=nolockfile But it still reports the…
Steve Vermeulen
  • 1,406
  • 1
  • 19
  • 25
2
votes
2 answers

how to stop shell script from getting confused by ack PATTERN escapes

I am trying to use ack to search (in Haskell files) for +|+ I looked at ack-grep: chars escaping but this doesn't help On Mac OS X 10.6 I get the following responses: $ ack -Q +|+ -bash: +: command not found Missing option after + ack: See ack…
2
votes
1 answer

Ack sometimes won't show line numbers and loses colorizing

Oddness in ack (betterthangrep.com) - Sometimes I get a line number, sometimes not. In the first example, I look for a simple phrase in some Python files. It works fine, and shows line number 233. In the second example, I look for all lines where…
DarenW
  • 16,549
  • 7
  • 63
  • 102
2
votes
1 answer

Windows Emacs shell/shell fail to execute ack perl script(locale error)

Typing this command on regular cmd.exe or cygwin termal gives me results as expected: $ ack hello (I have ack.bat that execute ack.pl in my PATH) However, when I run the same command from either shell or eshell in Emacs, it gives me this…
2
votes
2 answers

How do I add hamstache to Ack searches?

Ack isn't searching my .hamstache files. How do I get it included in searches? My .ackrc file looks like this: --type-add ruby=haml --type-add ruby=slim --type-add js=.coffee --type-set coffee=.coffee --type-add haml=hamstache When I run a…
AdamT
  • 6,405
  • 10
  • 49
  • 75
2
votes
2 answers

Use ack to find printing line in large project

So I have a very large project which when run prints a data set that is basicly this: x,y,z,?,? I want to find where this is being printed so i can remove this. I have tried ack-grep for std::cout but there are so many files. Does anyone know how…
Fantastic Mr Fox
  • 32,495
  • 27
  • 95
  • 175