[Insight-developers] ack: better than grep

Luis Ibanez luis.ibanez at kitware.com
Sat Oct 17 12:43:47 EDT 2009


             http://betterthangrep.com/


What is ack:

" ack is a tool like grep, designed for programmers
 with large trees of heterogeneous source code."

" ack is written purely in Perl, and takes advantage
 of the power of Perl's regular expressions."


How to install:

# Install the Macport:
http://trac.macports.org/browser/trunk/dports/perl/p5-app-ack/Portfile
# Install the Ubuntu package: ack-grep
# Install the Fedora package: ack
# Install the Gentoo package: sys-apps/ack


How to use:

      ack-grep     ImageFilter     ~/src/Insight


Advantages:

      As opposed to grep,
     ack will ignore CVS and SVN subdirectories, binary files, core dumps...
     (all those other files that programmers don't care about when looking
     for text in the code).

      Use full Perl regular expressions.

      Color highlighting of the output.

Common options:

     ack-grep is recursive by default. ( no need for grep's -r)

      -i       ignore case
      -w     full words only
      -l       print only filename
      -v      invert match

    --type=python searches only in python files (.py)
    --type=cpp searches only in C++ files


Fun option:

     --thpppt




---


     Luis


More information about the Insight-developers mailing list