473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

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

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
3 3645
numberwhun
3,509 Expert Mod 2GB
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
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
3,509 Expert Mod 2GB
Glad you found your answer.

Regards,

Jeff
Nov 7 '08 #4

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

Similar topics

9
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # Matching string patterns # # Sometimes you want to know if a string is of # particular pattern. Let's say in your website # you have converted all images...
31
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is...
1
by: Bryan Krone | last post by:
I have a stream of data comming off a serial port at 19200. I am wondering what is the most efficient way to grep through the data in realtime? I have 20 or so different strings I need to find. All...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
5
by: olaufr | last post by:
Hi, I'd need to perform simple pattern matching within a string using a list of possible patterns. For example, I want to know if the substring starting at position n matches any of the string I...
82
by: Edward Elliott | last post by:
This is just anecdotal, but I still find it interesting. Take it for what it's worth. I'm interested in hearing others' perspectives, just please don't turn this into a pissing contest. I'm in...
1
by: Chris Newman | last post by:
I am working on a script to process a large number of old electoral records. There are about 100,000 records in all but here is a representative sample BTW hd =household duties ALLISON,...
1
by: Arjun234 | last post by:
hi, I have a program to calculate the distance. its like this: open(IN, "/path/outModified.pl") or die "$!"; while (my $line = <IN>) { chomp($line); my @array = (split (/\s+/, $line)); #...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.