Catching the xml tag when only parent directory is known ..not the actual directory

Hi folks,

I have an query that is let say i have to search in an xml file an tag that is

<abcdef>

now this xml file is at

  /opt/usr/local

so one fastest way to achieve this is go to this location by cd /opt/usr/local and then do grep like this...

grep -i abcdef

but for this I must know the location but what about let say if I don't know the location and I know that it is some where inside the

 /opt

folder then how I would search pls advise .:confused:

Give an complete example of in data and desired output.

Hello,
You can try with command find , example:

find /opt -name '*.xml' -exec grep -i -H '<abcde>' {} \;

Regards.

disedorgue's suggestion can be improved in efficiency / speed by using + instead of \;

find /opt -name '*.xml' -exec grep -l '<abcde>' {} +

-l will return only the name of the file(s) that contain the pattern

Thanks for the reply but by executing it is throwing the exception ... that is

find:missing argument to '-exec'

please advise the apprpriate command for this as I want to list the file name and along the contents also .