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

Where should I put the ack configuration file on Windows?

I'm using ack (the grep replacement) on Windows XP under Strawberry Perl. Where should the .ackrc config file be placed, since ~/.ackrc is not reasonable on Windows?
Jeremy Dunck
  • 5,724
  • 6
  • 25
  • 30
4
votes
1 answer

Performing a sed -i on a list of files in stdin

So I recently upgraded Django from 1.4 to 1.5. I found out I need to update all my template codes to add single quotes like from {% url user_detail pk=user.pk %} to {% url 'user_detail' pk=user.pk %} I'm kind of new to bash commands like sed, but…
hobbes3
  • 28,078
  • 24
  • 87
  • 116
4
votes
1 answer

ack does not find symlinks

Here is a test: $ ln -nfs ~/.ssh ssh # Create a symlink in current dir. $ ack -g ssh # => nothing found $ ack -a -g ssh # => same here $ find . -name ssh # => found: ./ssh What I am doing wrong? )
chestozo
  • 1,203
  • 1
  • 12
  • 29
4
votes
1 answer

Why doesn't my ack --ignore-dir work?

I'm trying to search my entire server for a string, whilst excluding dev/ (-R) using ack. So far I have sudo ack -i --ignore-dir=dev * foo --version ack v1.39 But I'm getting an error. Where am I going wrong? Any help or advice on this matter is…
edev.io
  • 560
  • 5
  • 21
3
votes
1 answer

In Vim, can I conditionally turn off a plugin based on the environment?

My current Vim setup includes the ack.vim plugin. Now, I'd like to use the Vim setup I have on other systems, but some of those systems don't have ack installed. Is there a way for me to detect the presence or absence of ack in the .vimrc and turn…
abeger
  • 6,766
  • 7
  • 41
  • 58
3
votes
2 answers

How to exclude several lines around match with grep or similar tool?

I can find all non-matched lines of file with grep -v 'my_pattern' some_file. Also i can print few strings before/after/around match with -A, -B or -C options of grep. But i can't combine these two options to exclude lines with pattern and certain…
Andrey Starodubtsev
  • 5,139
  • 3
  • 32
  • 46
3
votes
2 answers

Ack.vim "No such file or directory" error on windows

I had Ack setup and working fine with Vim on my windows XP machine not long ago. Not sure what I did recently, but now it doesn't work. Here is an example of my problem in Vim: :Ack searchterm Returns this error message: ack: searchterm: No such…
asgeo1
  • 9,028
  • 6
  • 63
  • 85
3
votes
3 answers

How to search for '<' in files using ack in powershell in windows?

I cannot figure out how to escape the '<' character, and I am confused by the 'The system cannot find the file specified' error. Can anyone help? I am using ack in powershell in Windows XP. The question ack-grep: chars escaping is very similar to…
Tom
  • 543
  • 1
  • 9
  • 19
3
votes
3 answers

Strip last part of file by pattern - remove last certificate from chain

I have a chain of SSL certificates like this -----BEGIN CERTIFICATE----- MIICPjCCAeSgAwIBAgIRALMMpKnhRM2C7mnKI/rl8ggwCgYIKoZIzj0EAwIwgY4x CERT1 -----END CERTIFICATE----- -----BEGIN…
kyb
  • 7,233
  • 5
  • 52
  • 105
3
votes
2 answers

Is it possible to add a -G option to ~/.ackrc

When I do ack -G "^.*$" "foo" I get results... but when I put -G "^.*$" or -G="^.*$" or -G "^.*$" in my `~/.ackrc/ I get no results... Does anyone know if -G can be used in ackrc?
Aaron Gibralter
  • 4,773
  • 3
  • 35
  • 50
3
votes
1 answer

Why does ack over ssh not work?

I've got a simple bash script to remove some folders on a remote server over ssh. It basically does this: THE_HOST=12.34.56.78 ssh me@$THE_HOST "rm /the/file/path/thefile.zip" This works perfectly well. Before I do this I often search the contents…
kramer65
  • 50,427
  • 120
  • 308
  • 488
3
votes
2 answers

ack: how to match beginning of words?

I'm using ack like this: ack-grep assets\\. (on Ubuntu) However, I want to exclude results which do not begin with "assets". For example: siteassets. So far I've tried ack-grep ^assets\\. and other random stuff. (in Vim regex, the pattern is…
David Lam
  • 4,689
  • 3
  • 23
  • 34
3
votes
1 answer

Print out the matched word before the actual grep output is processed

My intention: Search trough source code and find keywords of interest. This is done to automate a small portion of codereview to find obvious programming errors like hardcoded keys and passwords. I currently have the following grep command to search…
user5989986
  • 73
  • 2
  • 9
3
votes
1 answer

Silversearcher/ack vs find,grep

Currently when I have to search for complex patterns in code, I typically use a combination of find and grep in the form: find / \( -type f -regextype posix-extended -regex '.*python3.*py' \) -exec grep -EliI '\b__[[:alnum:]]*_\b' {} \; -exec cat…
alpha_989
  • 4,882
  • 2
  • 37
  • 48
3
votes
1 answer

Ack in a bash subshell

I want to search a number of files "in a bash loop". Suppose I exec an ack search in a bash loop: #!/bin/bash seq 3 | while read i do test=`ack root /etc/passwd` echo $test done prints one empty line. Where as #!/bin/bash seq 3 | while…
Adobe
  • 12,967
  • 10
  • 85
  • 126