Paul Roub

A Software Tool Geek in His Natural Habitat

Vault! Fortress! Ack!

I’ve fallen in love with a new tool known as [ack"]. It’s basically grep, the way I want grep to work when coding:

  • Full Perl regular expressions
  • Iterates over directories by default
  • Skips source control directories (q.v.)
  • Easily restricted to certain file types

So if I’m searching a tree of Perl files, instead of something like:

grep pattern $(find . -name '*.pl' -or -name '*.pm' -or -name '*.pod' | \
  grep -v _sgbak)

(to find Perl program, module, and POD files, skipping anything in Vault/Fortress _sgbak folders), I can just say:

ack --perl pattern

And yes, as of version 1.74, ack includes "Vault ":http://sourcegear.com/vault/ and Fortress in its list of supported version control tools. So if I want to see references to the explodeMinion46 function, I can just say:

ack explodeMinion46

To recursively search my current directory, avoiding backup files along the way.

There are a number of other options, including configuring your own exclusions, etc. on the fly — but for me, the out-of-the-box behavior is now exactly what I want.