ack on solaris – grep recursively.

Some days back I posted an article on ack here. Today I was working on Solaris 9 and the default grep installed on the system does not have the \”-r\” option to search recursively. So, you know for all the time I had to keep using find with grep to work with directories recursively. This was something similar to the one below:

find . -type f -exec grep amit {} \\;

or with useless use of cat command:

find . -type f -exec cat{} \\; | grep amit

This is okay to make one or two searches but not that easy to keep typing and I already have too many aliase\’s to have one more added to the list. So, I tried to use the ack command on the Solaris box, knowing full well that the command is written in perl and BINGO.

There\’s not much you need to do to get ack working on Solaris. Here\’s what you need to do:

Copy the ack command to one of the paths in the PATH.

ack needs App/ needs File/

So, you copy these two files from any installation and then copy them to one of the paths mentioned in the output of \”perl -V\”. Done.

Wasn\’t that easy.