By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,852 Members | 2,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,852 IT Pros & Developers. It's quick & easy.

perl -e matching lines between two search patterns - not working

P: 2
Hi,

I have a tricky question!? :-)

I'm using the perl -e command in order to match lines between two search patterns. The problem I have is, for the first example it is working, for the second not, but I can't see the difference:

1) ok:

[kilian_koala]sharan:~/tmp/koala/nokkcc (171) % perl -ne 'print if /M1000C0/ .. /<\/Counter>/' nokrwwKOALA.xml

<Counter ID="ave_prxtot_class_0" OMeSName="M1000C0" NEName="AVE PRXTOT CLASS 0">
<Unit>RSSI_LEV</Unit>
<TimeRawFormula>ROUND((((DECODE(SUM(PRXTOT_DENOM_0 ),0,-112.1,10*LOG(10,(SUM(PRXTOT_DENOM_0*0.001*POWER(10 ,((ave_prxtot_class_0/621*62-112.1)/10)))/SUM(PRXTOT_DENOM_0))/0.001)))+112)*621/62+1),0)</TimeRawFormula>
<Description>
The average PrxTotal in relation to the unloaded area. NOTE: RNC GUI shows the dBm values, not the RSSI_LEV values. UPDATED:When the value for PrxTotal (received by every radio resource indication) is inside Class 0 range.
</Description>
</Counter>

2) Not ok:

[kilian_koala]sharan:~/tmp/koala/nokkcc (172) % perl -ne 'print if /M1000C1/ .. /<\/Counter>/' nokrwwKOALA.xml | more

-> endless output (does not stop at the end mark "</Counter>")! ???????

<Counter ID="prxtot_denom_0" OMeSName="M1000C1" NEName="PRXTOT DENOM 0">
<Unit>No.</Unit>
<TimeRawFormula>SUM(prxtot_denom_0)</TimeRawFormula>
<Description>
Denominator for PrxTotal Class 0 (=Unloaded Area). UPDATED:This counter is incremented by 1 whe
n PrxTotal (received by every radio resource indication) is inside Class 0 range.
</Description>
</Counter>
<Counter ID="ave_prx_noise" OMeSName="M1000C10" NEName="AVE PRX NOISE">
<Unit>-0.01*dBm</Unit>
<TimeRawFormula>ROUND((((DECODE(NVL(SUM(prx_noise_ denom_1),0),0,0,10*LOG(10,(SUM(prx_noise_denom_
1*0.001*POWER(10,((ave_prx_noise/100)/10)))/SUM(prx_noise_denom_1))/0.001))))*100),0)</TimeRawFormula>
<Description>
The average PrxNoise threshold used in admission control. The real dBm value is obtained when d
ivided by -100. UPDATED:In every radio resource indication period.
</Description>
</Counter>
<Counter ID="prx_noise_denom_1" OMeSName="M1000C11" NEName="PRX NOISE DENOM 1">
<Unit>No.</Unit>
<TimeRawFormula>SUM(prx_noise_denom_1)</TimeRawFormula>
<Description>
Denominator for average PrxNoise treshold used. UPDATED:In every radio resource indication peri
od.
</Description>
</Counter>
<Counter ID="max_prx_noise_value" OMeSName="M1000C12" NEName="MAXIMUM PRX NOISE VALUE">
<Unit>-0.01*dBm</Unit>
<TimeRawFormula>MIN(max_prx_noise_value)</TimeRawFormula>
<Description>
Maximum PrxNoise threshold value. NOTE! Real dBm value is obtained when divided by -100! UPDATE
D:This counter is updated if the value of the counter is smaller than the current value of PrxNoise thres
hold.
</Description>
</Counter>
<Counter ID="min_prx_noise_value" OMeSName="M1000C13" NEName="MINIMUM PRX NOISE VALUE">
<Unit>-0.01*dBm</Unit>
<TimeRawFormula>MAX(min_prx_noise_value)</TimeRawFormula>
<Description>
Minimum PrxNoise threshold value. NOTE2! Real dBm value is obtained when divided by -100! UPDAT
ED:This counter is updated if the value of the counter is bigger than the current value of PrxNoise thres
hold.

------------------

can someone see the difference????
Thx
dirknrw
Nov 7 '08 #1
Share this Question
Share on Google+
3 Replies


numberwhun
Expert Mod 2.5K+
P: 3,503
Well, in the second one you piped everything through more ( | more). If they output is endless with that one then it obviously did not work.

Regards,

Jeff
Nov 7 '08 #2

P: 2
Hi all,

a fellow of mine found already the answer:

"M1000C1" string can be found in many lines, therefore many sections are found...

You need to use the bounderies notation (word bounderies):

solution for 2) use \b<searchpatter>\b

[kilian_koala]sharan:~/tmp/koala/nokkcc (193) % perl -ne 'print if /\bM1000C1\b/ .. /<\/Counter>/' nokrwwKOALA.xml
<Counter ID="prxtot_denom_0" OMeSName="M1000C1" NEName="PRXTOT DENOM 0">
<Unit>No.</Unit>
<TimeRawFormula>SUM(prxtot_denom_0)</TimeRawFormula>
<Description>
Denominator for PrxTotal Class 0 (=Unloaded Area). UPDATED:This counter is incremented by 1 when PrxTotal (received by every radio resource indication) is inside Class 0 range.
</Description>
</Counter>
Nov 7 '08 #3

numberwhun
Expert Mod 2.5K+
P: 3,503
Glad you found your answer.

Regards,

Jeff
Nov 7 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.