How to find the number of columns in xml file.
i tried following command.
#!bin/ksh
cat $1 | grep -c "</mdm:attribute>"
exit 0
but i am not getting accurate result which is not matching with the manual count.
data format :
<mdm:attribute> value </mdm:attribute>
Hope this will help you ..
perl -nle 'print $1 if /<\/(.+?)\>/g' file.xml | wc -l
It's not perl script it is UNIX ibm aix.
victory:
... it is UNIX ibm aix.
Did you try to execute the above command?
xml doesn't have "columns" per se so I'm not really sure what you want. Could you show a more complete input file and what you're expecting to get from it?
rdrtx1
January 8, 2013, 12:02pm
6
try also:
awk '{c+=gsub("</mdm:attribute>","&")} END {print c}' file.xml
The grep counts lines with matches, not matches. Preprocess the file so every > becomes a line feed and grep for "</mdm:attribute$".