Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have ack-grep installed on my local machine, and find it indispensable for quickly 'acking' through a codebase when debugging.

However, on my cheap shared hosting, there is no ack-grep. One of the testimonials on betterthangrep.com mentions a

Rube Goldberg mess of find/grep/xargs

which sounds like what I need, but coming from the opposite direction.

Does anyone know what it might be?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

The actual command is named ack. (Some distributors may have renamed it to ack-grep due to name collisions.) The official website is indeed http://betterthangrep.com, and it has a long list of installation methods, even in case your distribution does not have ack.

For example, you can download App::Ack from Perl's CPAN (using cpanminus):

cpanm --sudo App::Ack

Or get the "standalone" version:

curl http://betterthangrep.com/ack-standalone > ~/bin/ack
chmod +x ~/bin/ack
share|improve this answer
    
Stunning, thanks. Linux FTW –  user908393 Aug 25 '11 at 11:22

Yes, you can do it manually, and in fact you should know how to do it manually. For example, if you've been doing

ack function_name --php

you can do that (pretty much) as

find . -name '*.php' | xargs grep function_name

It's longer to type, and you can make an alias or shell script out of it, but it's good to know how to do it, just for the sake of knowing how to do it.

Your question makes me smile because usually what I hear is old guard Unix greybeards saying "You don't need ack, just use find, xargs and grep." It's cool to see someone coming at it from the other direction.

share|improve this answer
1  
Awfully close to "You don't need that newfangled wheel, just reinvent your own." –  grawity Aug 25 '11 at 15:50
1  
It certainly is, but it's a battle I've stopped getting into. If people want to do it the old way because That's How Ken And Dennis Say It Should Be, then that's up to them. –  Andy Lester Aug 25 '11 at 22:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.