1847177 Members
5557 Online
110263 Solutions
New Discussion

find help

 
SOLVED
Go to solution
Anthony khan
Frequent Advisor

find help

Hi All,

I know its very easy to get but when i run the following command its take forever... what I want is to find all the files having this line CN=/usr/local/ias_prod451 so I can change to new path, i am running

find . -exec grep -l 'CN=/usr/local/ias_prod451' {} \;

Any suggestion what i'm doing wrong
4 REPLIES 4
Mark Greene_1
Honored Contributor

Re: find help

try this:

find . -type f -exec grep -l 'CN=/usr/local/ias_prod451' {} \;

if you have nfs files systems you want to skip (which may be what is taking so long), add this:

find . -type f ! -fsonly NFS -exec grep -l 'CN=/usr/local/ias_prod451' {} \;

HTH
mark
the future will be a lot like now, only later
Jeff Schussele
Honored Contributor

Re: find help

Hi Anthony,

What's your PWD when you run this. Limit the start to ONLY where you have iPlanet App Server installed.

Also if your vxfs FS usage is high in the FS(s) being searched & you have OnLineJFS, a defrag can zip the search along a little.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Darrell Allen
Honored Contributor
Solution

Re: find help

Hi,

This thread has some interesting ideas concerning searching for a string in text files:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xd19e3fa720f3d5118ff40090279cd0f9,00.html

The command which worked best for me was:
find / -type f -exec grep -l 'CN=/usr/local/ias_prod451' {} \; | xargs file | grep text | awk -F: '{print $1}'

Darrell

"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Robin Wakefield
Honored Contributor

Re: find help

Hi Anthony,

I always try and avoid -exec, as it generates one process for each file. With xargs, it will process as many files as it can fit in one command, so something like the following may help:

find / -type f | xargs file | grep text | cut -d: -f 1 | xargs grep -l 'CN=/usr/local/ias_prod451'

Rgds, Robin