Hi Anirban,
On Thu, 15 Mar 2012 20:41:31 +0530
Anirban Adhikary wrote:
> I am writting a following code to parse this xml but not able yo understand
> that why the value of $bsc_id_1 getting changed.
> here is my code
>
> use strict;
> use warnings;
>
> my $xml_file_to_read = "BSC-19478.xml";
On 12-03-15 01:32 PM, Graeme St.Clair wrote:
I agree with Lawrence! I am currently using two older packages called
XML::SAX and XML::SAX::Expat ; they may well be a bit old-fashioned,
but they work for me.
I would suggest XML::Twig
--
Just my 0.0002 million dollars worth,
Shawn
Progr
: anirban.adhik...@gmail.com
Subject: Re: XML parsing question
On 03/15/2012 09:11 AM, Anirban Adhikary wrote:
I am writting a following code to parse this xml but not able yo
understand
that why the value of $bsc_id_1 getting changed.
here is my code
use strict;
use warnings;
my
On 03/15/2012 09:11 AM, Anirban Adhikary wrote:
> I am writting a following code to parse this xml but not able yo
understand
> that why the value of $bsc_id_1 getting changed.
> here is my code
>
> use strict;
> use warnings;
>
> my $xml_file_to_read = "BSC-19478.xml";
> my $counter = 1;
> my $
I am writting a following code to parse this xml but not able yo understand
that why the value of $bsc_id_1 getting changed.
here is my code
use strict;
use warnings;
my $xml_file_to_read = "BSC-19478.xml";
my $counter = 1;
my $bsc_id_1;
my $bsc_id;
open my $RFH,'<',$xml_file_to_read or die "Can'
On 12-03-15 11:01 AM, Anirban Adhikary wrote:
I need to create a new xml file from this xml.
Now I need to store the first BSC id and need to check it against the other
BSC ids. If both ids are same then I need to write the the contents of
between the BSC id tag in a new xml file.
What have you
Hi List ,
I have a xml file which looks like
10
1,3,4,7
12,16,21
2,3,3
1,3,6,8
12,17,25
50
AMI_BRANLY_B_1
10
1,3,4,7
12,16,21
2,3,3
1,3,6,8
ON
ON
0
I need to create a new xml file from
Thanks everyone for the great ideas. After I implemented the
solution(s) you guys proposed I stumbled upon Nagios::Object
(http://search.cpan.org/~duncs/Nagios-Object-0.21.16/). I did learn a
few things from your ideas though so I am grateful none the less!
I recommend anyone working with Na
On 31/01/2012 22:43, Brandon Phelps wrote:
Hello all,
I am attempting to parse a Nagios status.dat file and am curious about
what the most efficient way to do this would be. I'm sure I could come
up with something but it would be very convoluted and I'm sure there is
a better way. Below is a sam
February 01, 2012 2:11 PM
To: jbiskofski
Cc: Brandon Phelps; beginners@perl.org
Subject: Re: Parsing Question
Hi jbiskofski,
This script will not work WHY? -- Scalar found where operator expected
at . [ Please Check ] line 72, near "$we_are_inside_hoststatus_block"
..
This commun
ah - i get it now.
thanks.
On Wed, Feb 1, 2012 at 3:05 PM, Jim Gibson wrote:
> On 2/1/12 Wed Feb 1, 2012 11:24 AM, "jbiskofski"
> scribbled:
>
> > Your comment about the open statement is OK. I guess it really comes down
> > to style. I was trying to write something clear that Brandon could
On 2/1/12 Wed Feb 1, 2012 11:24 AM, "jbiskofski"
scribbled:
> Your comment about the open statement is OK. I guess it really comes down
> to style. I was trying to write something clear that Brandon could improve
> upon.
It is not simply a matter of style. Because of operator precedence, the
s
Timothy
Could it be that when you copy pasted the script the line wrap got messed
up? It works fine for me.
Im using perl 5.12.3
Your comment about the open statement is OK. I guess it really comes down
to style. I was trying to write something clear that Brandon could improve
upon.
Here is a p
Hi jbiskofski,
This script will not work WHY? -- Scalar found where operator expected
at . [ Please Check ] line 72, near "$we_are_inside_hoststatus_block"
..
On Wed, Feb 1, 2012 at 6:38 PM, jbiskofski wrote:
> Hey Brandon
>
> Here is a solution to this problem. It is purposely r
Hey Brandon
Here is a solution to this problem. It is purposely really long. It takes
the simplest most understandable solution.
If you have questions about it let me know.
#!/usr/local/bin/perl
# always a good idea, forces scope to if/for/foreach/while blocks
use strict;
# open the file, int
Just my $0.02... can't help offering a slight rewrite of David's great
program.
Now it's runnable on 5.010 and earlier, and should give out some warnings
if hoststatus sections are somehow corrupt:
$|++; # comment it out if you don't need to buffer the output
my $section_started;
my ($host, $state
Brandon,
I took most of your comments and sample data and put it in the following
program. Taking the data out of the program and parsing it from files and
directories, might be a good exercise for you. Generally variables are best
declared close to where they are first used. Since the scope of
Thanks a ton David,
This will definitely help! Not able to try it now but I'll give it a
shot first thing tomorrow.
-Brandon
On 1/31/2012 8:15 PM, Kronheim, David (Contr) wrote:
Brandon,
I took most of your comments and sample data and put it in the following
program. Taking the data out
Hello all,
I am attempting to parse a Nagios status.dat file and am curious about
what the most efficient way to do this would be. I'm sure I could come
up with something but it would be very convoluted and I'm sure there is
a better way. Below is a sample of the file. The sections I am
in
D. Bolliger wrote:
Gallagher, Tim F (NE) am Donnerstag, 14. Dezember 2006 15:29:
Lets say that I have a list of data that have a few things in common, ie
this is a 1 test to see 2 what is happening 3 to the state of the 4
country
all work 1 and no 2 play makes 3 jack a dull boy 4
how 1 much woo
Gallagher, Tim F (NE) am Donnerstag, 14. Dezember 2006 15:29:
> Lets say that I have a list of data that have a few things in common, ie
>
> this is a 1 test to see 2 what is happening 3 to the state of the 4
> country
> all work 1 and no 2 play makes 3 jack a dull boy 4
> how 1 much wood 2 could a
Lets say that I have a list of data that have a few things in common, ie
this is a 1 test to see 2 what is happening 3 to the state of the 4
country
all work 1 and no 2 play makes 3 jack a dull boy 4
how 1 much wood 2 could a wood 3 chuck 4 chuck
so I want to grab all data between 1 - 2 and 3 -
William Black wrote:
Hello,
I'm trying to figure out how to read multiple lines from a file at once for
parsing. For example,, If the file contained the following:
input file
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
I want to read in lines 1-4 for processing then d
Hello,
I'm trying to figure out how to read multiple lines from a file at once for
parsing. For example,, If the file contained the following:
input file
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
I want to read in lines 1-4 for processing then during the next iteratio
or will I have to dig deeper in regex fundamentals.
Thanks for ur help.
Regards
Rajeev
-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]
Sent: Friday, July 11, 2003 10:46 PM
To: [EMAIL PROTECTED]
Subject: Re: Regex parsing question
Rob Dixon wrote:
> Perl wrote:
> >
Rob Dixon wrote:
> Perl wrote:
> > I am attempting to parse a log file that looks something like:
> >
> > 759033281 TE18 constructor - add to MDBTable
> > EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD
> > 759033281 TE18 AddRef=2
> > EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD
> > 75903328
Perl wrote:
> I am attempting to parse a log file that looks something like:
>
> 759033281 TE18 constructor - add to MDBTable
> EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD
> 759033281 TE18 AddRef=2
> EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD
> 759033281 TE18 S-REXCH-MSG-07
> 75903328
Perl wrote:
> I am attempting to parse a log file that looks something like:
>
> 759033281 TE18 constructor - add to MDBTable
> EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD
> 759033281 TE18 AddRef=2
> EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD
> 759033281 TE18 S-REXCH-MSG-07
> 75903328
Perl wrote:
>
> I am attempting to parse a log file that looks something like:
>
> 759033281 TE18 constructor - add to MDBTable
> EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD
> 759033281 TE18 AddRef=2
> EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD
> 759033281 TE18 S-REXCH-MSG-07
> 7590
I am attempting to parse a log file that looks something like:
759033281 TE18 constructor - add to MDBTable
EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD
759033281 TE18 AddRef=2
EX:/O=MSGENG/OU=EUROPE/CN=RECIPIENTS/CN=PHARWOOD
759033281 TE18 S-REXCH-MSG-07
759033281 TE18 S-REXCH-MSG-06
7590
> -Original Message-
> From: Anderson, Carlin [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 19, 2001 2:53 PM
> To: '[EMAIL PROTECTED]'
> Subject: Parsing question
>
>
> We are integrating with the Yahoo storefront for some
> customers, and I am
We are integrating with the Yahoo storefront for some customers, and I am
having a problem accessing some of the data elements within the data stream.
This is a dump of the raw information dumped by my program:
Bill-Address1 = 5575 North Service Road
Bill-Address2 = 4th Floor
Bill-City = Burling
- Original Message -
From: Stout, Joel R <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 24, 2001 10:20 PM
Subject: [beginner] file parsing question
> Sorry so lengthy but here goes:
>
> I am a Perl newbie and trying to parse a file. Dependi
--- Timothy Kimball <[EMAIL PROTECTED]> wrote:
> Ah, yes, one of the most frustrating bugs in the world:
> : if ($REFln[1] = "SN") {
> This *assigns* the value "SN" to $REFln[1]. What you want to do is
> *test* it. String comparisons in Perl are done with "eq" (and numeric
> comparisons with
On Tue, Apr 24, 2001 at 04:33:00PM -0400, Timothy Kimball wrote:
> You can avoid this by always writing comparisons with the constant
> (if there is one) on the left-hand side:
>
> if ("SN" eq $REFln)
>
> but I rarely see people actually do that.
I think that's because it feels so unnatu
Hi Joel,
Did you type this in by hand? :)
> parseRef ($testln);
> sub parseREF {
You would want to change one of those! Anyways..
Your problem is in this line:
> if ($REFln[1] = "SN") {
= is for assignments. You want this to be:
if ($REFln[1] eq "SN") {
To lear
Ah, yes, one of the most frustrating bugs in the world:
: if ($REFln[1] = "SN") {
This *assigns* the value "SN" to $REFln[1]. What you want to do is
*test* it. String comparisons in Perl are done with "eq" (and numeric
comparisons with "=="). So you want this:
if ($REFln eq "SN")
Sorry so lengthy but here goes:
I am a Perl newbie and trying to parse a file. Depending on the tags in the
data I want to parse each line a different way. I built the following
program to test my process.
use strict;
my (@lines, $testln, @REFln);
while (<>) {
chomp;
testType
38 matches
Mail list logo