Searching the value of a specific attribute among xmls files from a particular directory location

Hi Folks ,

I have the different xml files at the following directory `/opt/app/rty/servers/tr/current/ops/config`

Let's say there are three files named

    abc.xml
    bv.xml
    ert.xml

Now inside these xml there can be many tags as like shown below

   <bean id="sdrt" class="com.interfaces.send.erty">                    
        <property name="eprocDependentOnClientAddress"><value>@argon.tdw.client.address@</value></property>
        <property name="eprocDependentOnClientAddressEod"><value>tyu</value></property>                    
    </bean>    

Now my objective is that inside directory /opt/app/rty/servers/tr/current/ops/config I need to search in all xml files and have to find that in every xml in context to property tag there should be no value starting from @ tag and also ending with @ tag

Let's say for example in the above xml file the below is correct

   <property name="eprocDependentOnClientAddressEod"><value>tyu</value></property>

but the below is not correct

   <property name="eprocDependentOnClientAddress"><value>@argon.tdw.client.address@</value></property>

so please advise what will be the single command in unix to search the files names that is those xml in which there is a tag starting with @ inside the property tag , There must be a command starting with egrep..:rolleyes:

A simple approach would be:

grep '<property.*<value>[^@].*[^@]</value></property>' file

But that assumes every property is neatly on one line.

Thanks but when i executed this as in this fashion below

grep '<property.*<value>[^@].*[^@]</value></property>' *.xml

well it searches among all xml's which is OK but it bring out the all the value tags but i am looking for the tags like as shown below only

<property name="eprocDependentOnClientAddress"><value>@argon.tdw.client.address@</value></property> 

so as you can observe the output should be only the tags in which from within the value tag the value is staring from @ tag and ending with @ tag only , please advise how to achieve this:confused:

Would replacing either of the two occurrences of [^@] with just @ cure the problem?

Like RudiC says, if are looking for the opposite, then you get those lines that contain the @ characters in the value part.

To get only the file names with the wrong value tags, try the -l option:

grep -l '<property.*<value>@.*@</value></property>' file(s)

Thanks but it is still not working , please advise can it be like this as I have shown below since outside there is a bean tag inside there is a property tag and inside that there is value tag . please advise

grep -l '<bean.*<property.*<value>@.*@</value></property></bean>' *.xml

Please be more precise: WHAT is "still not working"? Post input, commands and results and tell us what and why doesn't meet your needs.