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/Ack.pm.

Ack.pm needs File/Next.pm

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.


2 thoughts on “ack on solaris – grep recursively.”

    1. no doubt about that .. it is definately not the right way to install modules but then I don’t know perl much and did not want to spend a lot of time into doing something that is just a means to and end. Thanks for the link on the standalone ack… .Will definately try this.