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

Get ack to exclude files with type ".min.js"

I minify javascript files on the fly and produce a .min.js file beside the existing file. This is a problem though when using ack as it treats these as .js files and searches them littering my results screen with minified javascript. I've tried…
Kevin Old
  • 969
  • 1
  • 9
  • 20
7
votes
3 answers

Why does `ack` not produce output when used with `bash` like this?

I'm guessing this has nothing to do with ack but more with bash: Here we create file.txt containing the string foobar soack can find foobar in it: > echo foobar > file.txt > echo 'ack foobar file.txt' > ack.sh > bash ack.sh foobar > bash <…
Peter V. Mørch
  • 13,830
  • 8
  • 69
  • 103
7
votes
3 answers

ack - search for multiple patterns (logical AND)

How to search file with the ack to find lines containing ALL (nor any) of defined patterns? the ANY (OR) is easy, like: ack 'pattern1|pattern2|pattern3' but how to write the AND (ALL) ? e.g. how to write the following: if( $line =~ /pattern1/ &&…
cajwine
  • 3,100
  • 1
  • 20
  • 41
7
votes
1 answer

How do I use ack or ag within vim with Unite.vim?

I have found a lot of pages with config examples such as: let g:unite_source_grep_command = 'ag' let g:unite_source_grep_default_opts = \ '--line-numbers --nocolor --nogroup --hidden --ignore ' let g:unite_source_grep_recursive_opt = '' or " Use…
Jeff
  • 1,051
  • 1
  • 13
  • 26
7
votes
2 answers

How to specify an ignore pattern with ack?

I'm trying to search for lines containing 'foo' but these lines must not contain 'bar'. What's a good way to search with these parameters with ack? I can do: ack "foo" | grep -v "bar" but it doesn't keep the nicely layed-out and coloured output of…
DBedrenko
  • 4,871
  • 4
  • 38
  • 73
7
votes
1 answer

Ack search with whitespaces

I am using Ack with MacVim and the Janus plugin. Everytime I want to search for a string in my project that contains whitespaces, I need to escape these with \ or . Is there a way to avoid this? I know that once you enter a whitespace, the directory…
Flov
  • 1,527
  • 16
  • 25
6
votes
5 answers

Obtain patterns in one file from another using ack or awk or better way than grep?

Is there a way to obtain patterns in one file (a list of patterns) from another file using ack as the -f option in grep? I see there is an -f option in ack but it's different with the -f in grep. Perhaps an example will give you a better idea.…
Rock
  • 2,827
  • 8
  • 35
  • 47
6
votes
1 answer

Silver Searcher: how to unignore files in the .gitignore?

I have a folder of aliases. These are bash files. Some are sensitive, so I keep them in a .gitignore. ~/.bash_utilities bash_a.sh bash_b.sh .gitignore .gitignore: bash_b.sh The problem is that my Silver Searcher looks at the .gitignore…
WebQube
  • 8,510
  • 12
  • 51
  • 93
6
votes
2 answers

Where is `_softmax_cross_entropy_with_logits` defined in tensorflow?

I am trying to see how softmax_cross_entropy_with_logits_v2() is implemented. It calls _softmax_cross_entropy_with_logits(). But I don't see where the latter is defined. Does anybody know how to locate its definition? $ ack…
user1424739
  • 11,937
  • 17
  • 63
  • 152
6
votes
3 answers

Add SCons files to ack searches

I love the code search utility ack. It is smart enough to look through Makefiles, but doesn't know about the SConstruct and SConscript files that scons uses. How do I add those to the files that ack will look in?
jblocksom
  • 14,127
  • 5
  • 34
  • 30
6
votes
4 answers

Search whole project by default with Vim/Ack

I would like to use Ack (or similar plugin if something else can do the job) to search my whole project in Vim by default, rather than just the current directory. Ideally I'd end up with a process that works like using Cmd+Shift+F in Sublime. How…
RobHeaton
  • 1,390
  • 1
  • 9
  • 13
6
votes
4 answers

How can I search for (escape) a dollar sign using ack?

I want to ack for the literal string: "$$" in a code base, but escaping the dollar sign like this: ack \$\$ doesn't work.
Christopher Scott
  • 2,383
  • 2
  • 25
  • 23
6
votes
3 answers

Grep and ignore minified javascript

Is there a way to tell ack/grep to ignore minified Javascript? Those files have thousands of characters per line and screw up the search output.
Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
6
votes
3 answers

Turn on Ack in MacVIm

I'm new to MacVim and have installed Janus. I can't figure out how to search my project using Ack.vim. For janus it says "Customizations: Janus rebinds command-shift-f () to bring up :Ack." But when I do command-shift-f I get this message: The…
AdamT
  • 6,405
  • 10
  • 49
  • 75
5
votes
1 answer

ack is not doing a recursive grep

ack (the grep tool written in Perl) does not find a file that grep -r finds, and I cannot find the right options to get it to work. The following shows ack did not find the target string, which is in a regular file in a sub-directory. It's on Bash…
Andrew_1510
  • 12,258
  • 9
  • 51
  • 52