Using grep

Might you know the Unix command that "would not display" the directories for which the following grep command, shows "find: cannot open /directory/etc"

This is my grep command:
grep -i searchWord `find . -name *.xml -print`
wemtzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cyclops3590Commented:
the -v switch
grep -v -i searchWord `find . -name *.xml -print`
0
ozoCommented:
find . | grep ^find:
0
ozoCommented:
grep -i searchWord `find . -name *.xml -print 2> /dev/null`
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Cyclops3590Commented:
oops, misunderstood the question.  I read it quick and thought you were going for inverting the printed results.
0
joolsCommented:
do you have permissions to access /directory/etc?
0
wemtzAuthor Commented:
jools, do I have permission....NO.  I'm sure if I was root, maybe I could access all of the directories.
0
joolsCommented:
So you don't want to see the errors?

Try;
grep -i searchWord `find . -name *.xml -print` 2>/dev/null
0
TintinCommented:
The more common way of writing this is

find . -name "*.xml" -exec grep -i searchWord {} \; 2>/dev/null
0
ahoffmannCommented:
Tintin's suggestion improved to work on any shell on any *x ;-)
sh -c 'find . -type f -name "\*.xml" -exec grep -i searchWord {} \; 2>/dev/null'
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
joolsCommented:
Sorry Guys, I just reread and saw ozo's answer! I didn't see it before honest!

I don't mind if points are changed (if thats possible!)

Just in case you were wondering the 2> redirects all errors (stderr), in this case it sends them to null (think trash).

J
0
joolsCommented:
Thanks,

Apologies wemtz, you may have missed the ozo response as well, would you please be so kind as to regrade, I won't moan again.

Cheers All.
0
wemtzAuthor Commented:
jools, I do not understand your request.  I will include everyone when I issue the points.
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.