ack on solaris – grep recursively.

2010-06-25 236 words 2 mins read

<span style="background-color: #ffffff;">Some days back I posted an article on ack <a href="" target="_blank">here. Today I was working on Solaris 9 and the default grep installed on the system does not have the &#8221;-r&#8221; 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:

<span style="background-color: #ffffff;">find . -type f -exec grep amit {} \;

<span style="background-color: #ffffff;">or with useless use of cat command:

<span style="background-color: #ffffff;">find . -type f -exec cat{} \; | grep amit

<span style="background-color: #ffffff;">This is okay to make one or two searches but not that easy to keep typing and I already have too many aliase&#8217;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.

<span style="background-color: #ffffff;">There&#8217;s not much you need to do to get ack working on Solaris. Here&#8217;s what you need to do:

<span style="background-color: #ffffff;">Copy the ack command to one of the paths in the PATH.

<span style="background-color: #ffffff;">ack needs App/

<span style="background-color: #ffffff;"> needs File/

<span style="background-color: #ffffff;">So, you copy these two files from any installation and then copy them to one of the paths mentioned in the output of &#8221;perl -V&#8221;. Done.

<span style="background-color: #ffffff;">Wasn&#8217;t that easy.

<span style="background-color: #ffffff;">

Tags: ack Solaris


Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it