count number of lines between two tag

Hi
I have a big xml file of having many data

</Data>
</Node>
<Node>
List
<abc>3932590983
3396003964
3355713230</abc>
</Data>
</Node>
</Data>
</Node>
<abc>3932590983
3396003964</abc>

I want to count the lines present betweem tag starting with abc and ending with abc

so o/p will be like

abc=3
abc=2

Please help me to get data.

$> awk '/abc/ && c==0 {c+=1; next} /abc/ && c>0 {c+=1; print "abc="c; c=0; next} c>0 {c+=1}' infile
abc=3
abc=2

Hi thanks for your reply
Can we also print the line number of starting tag
like op

 
Line 5 abc=3
Line 11 abc=2

Yes we can:

$> awk '/abc/ && c==0 {c+=1; l=NR; next} /abc/ && c>0 {c+=1; print "Line",l,"abc="c; c=0; next} c>0 {c+=1}' infile
Line 5 abc=3
Line 12 abc=2

Another one:

awk '/<abc>/{c=0;n=NR}{c++} /<\/abc>/{print "Line " n " abc=" c}" file

Can you please Explain the above code in detail for me?

Hi I am not getting correct output
My actual file is like

 
<?xml version="3.0" encoding="ISO-8799-1" standalone="yes"?>
<Config File="trees/banking/saved/data.xml" Origin="Member1">
<AccountStructure Name="Bank_acc" type="account" id="76" ServiceId="account" TariffType="account">
<Index>0</Index>
<Comment>Banking account
account class : 5692 ,2122,
2345 , 4567
PLAN STRATED FROM 20100401.</Comment>
<DefaultPrice>12.0</DefaultPrice>
<DefaultInterval>12</DefaultInterval>
<Node>
account
<Node>
Saving
<Condition id="2">
ServiceCode
<Code>0</Code>
</Condition>
<Condition id="1">
AccountCase
<Case>0</Case>
</Condition>
<Node>
Home
<Condition>
abcList
<Type>3</Type>
<abc>0
1
2
3
5
6
7
8
9</abc>
</Condition>
<Node>
Offnet
<Node>
within bank
<Node>
within
<Condition>
abcList
<Type>0</Type>
<abc>0
1
2
3
4
5
6
9</abc>
</Condition>

When I am running command I am getting

 
awk '/abc/ && c==0 {c+=1; l=NR; next} /abc/ && c>0 {c+=1; print "Line",l,"abc="c; c=0; next} c>0 {c+=1}' ta
Line 26 abc=3
Line 36 abc=10
Line 47 abc=8

wheras right op should be like

Line 31 abc=9
Line 50 abc=8

Please help me

---------- Post updated at 11:17 PM ---------- Previous update was at 11:10 PM ----------

Hi All
Thanks for reply
this code worked perfectly

awk '/<abc>/{c=0;n=NR}{c++} /<\/abc>/{print "Line " n " abc=" c}' file

Thanks again

My code could not work on your second example since you have stuff like "abcList" in it. Adding < and > to the pattern would have helped too. Anyway, Franklin's code is shorter and more efficient ^^

my $cnt=0;
local $/="</abc>";
while(<DATA>){
  if(/.*(<abc>.*<\/abc>)/s){
    my @tmp = split("\n",$1);
    print "abc=",$#tmp+1,"\n";
  }
}
__DATA__
</Data>
</Node>
<Node>
List
<abc>3932590983
3396003964
3355713230</abc>
</Data>
</Node>
</Data>
</Node>
<abc>3932590983
3396003964</abc>