473,221 Members | 1,883 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,221 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 3638
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: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.