ack
ack is like grep, but better. Especially if you’re using it for source code. If you don’t have ack yet, and you program, do yourself a favor and run:
$ cpan App::Ack
I assume you’re running Linux or OS X by saying that. If you’re on Windows, run:
C:\>ppm
ppm> install ack
(Thanks to Matthew Wilson for the proper instructions for Windows. Takin’ one for the team.)
ack is for searching a codebase for various things. It supports regex search and is smart about what to search and what to ignore. By default, it only searches through source code files (no, not just Perl source code). It also by default operates recursively. It also knows to exclude subversion and CVS special folders. Brilliant.
ack’s output is similar to grep, except that matches are highlighted for you, making it a million times easier to read.
$ ack printf
It also features a very useful switch which yields endless hours of entertainment:
$ ack --thppppppt!
_ /|
\'o.O'
=(___)=
U ack --thppppppt!
So give ack a try and send a thank-you email off to Andy Lester for making your life a bit easier.
export GREP_OPTIONS="--color=auto" for highlighting when you're forced to use grep.
For ActiveState Perl on Windows, it seems to be:
ppm
install ack
Similar to TRS-80's solution, I do this:
alias grep='grep --color=always'
in my .bashrc