Saurabh-

This'll end up being very off-topic, but I would personally use Perl and XML::Simple (it parses XML into a Perl hashmap at which point it is easy to enumerate the keys). Another option is to use more advanced regular expressions in your grep command. See:

http://www.regular-expressions.info/grep.html

HTH,
Stephen


Saurabh Agrawal wrote:
Hi everyone,
  I have a well formed XML but not a well formatted XML like "
<locale>DE
        </locale><a>
dfsf</a><locale>
FR</locale>
<b>ddsdd</b>
                      <locale>DE
</locale>
Now my requirement is to counter number of occurents in locale node for DE and FR locale. For Example: Number of DE occurences is : 2
                    Number of FRoccurences is : 1
since the XML if not formatted so i cant use GREP for following pattern : grep "<locale>DE</locale>" <filename> | wc -l Can anyone suggest me how can i count number of occurences in such an XML file whose format can change anytime.It may happen that entire thing is one line or may be as scattered as above. Any quick help would be appreciated.Its urgent for me and i am stuck here.Can anyone guide me what can i do in quick time. thanks in advance to everyone,
Saurabh

-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to