Re: Back Chat:RE: Help with parsing output

2002-05-31 Thread drieux
On Friday, May 31, 2002, at 07:20 , Sudarsan Raghavan wrote: [..] > > Can the OP confirm if it works fine > > I cut-pasted the input from original mail. Can you attach the file that > you are > using as input so that I can test it here. http://www.wetware.com/drieux/pbl/Sys/Admin/prstatFilter.t

Re: Back Chat:RE: Help with parsing output

2002-05-31 Thread Sudarsan Raghavan
drieux wrote: > On Friday, May 31, 2002, at 02:13 , Sudarsan Raghavan wrote: > > > while () { > > chomp; > > s/^\s+//; > > next if ((1 .. /^NPROC/) || m/^$/); > ># The conditions have been swapped here > ># Explanation for this is one of my earlier mails >

Re: Back Chat:RE: Help with parsing output

2002-05-31 Thread drieux
On Friday, May 31, 2002, at 02:13 , Sudarsan Raghavan wrote: > while () { > chomp; > s/^\s+//; > next if ((1 .. /^NPROC/) || m/^$/); ># The conditions have been swapped here ># Explanation for this is one of my earlier mails > unless (/^Total/) { >

RE: Help with parsing output

2002-05-31 Thread Kipp, James
On Thursday, May 30, 2002, at 10:42 , Kipp, James wrote: <> very well. i see. > > while () { > next if $_ =~ /USER/; <<# # why not clean the front first and not need a $null # s/^\s+//; my($user,$cpu,$mem,$vmem,$cmd) = split(/\s+/); print ":$user:$cp

RE: Help with parsing output

2002-05-31 Thread Kipp, James
Thanks for the explanation. "Kipp, James" wrote: > > I think that is how he eliminates lines up to the NPROC line. so in other > words, next if range from line 1 to /^NPROC/. and it does work. Yes that is right, I also have to point out a potential problem here This will not work if the first

Re: Back Chat:RE: Help with parsing output

2002-05-31 Thread Sudarsan Raghavan
"CATHY GEAR (TRUST HQ)" wrote: > Yes please post the final working solution! This is always helpful. > > Thanks > > Cathy > The best solution was John's offer while () { if ((/NPROC/ .. /^Total/) && /\d/) { my ($user, $mem, $cpu) = (split)[1, 4, 6]; print

Back Chat:RE: Help with parsing output

2002-05-31 Thread CATHY GEAR (TRUST HQ)
Yes please post the final working solution! This is always helpful. Thanks Cathy -Original Message- From: Sudarsan Raghavan [mailto:[EMAIL PROTECTED]] Sent: 31 May 2002 09:01 To: Kipp, James Cc: Perl Subject: Re: Help with parsing output

Re: Help with parsing output

2002-05-31 Thread Sudarsan Raghavan
> < ... > so I fear his (1../^NPROC/) isn't doing quite what he was hoping that > it would be doing >> > > yes, i noticed that, but was easily fixed with minor adjustments I failed to notice this mail, was the adjustment what I had mentioned about swapping the conditions in the if statement.

Re: [Fwd: Re: Help with parsing output] (forgot to post to the list)

2002-05-30 Thread Sudarsan Raghavan
Sudarsan Raghavan wrote: > Original Message > Subject: Re: Help with parsing output > Date: Fri, 31 May 2002 11:07:16 +0530 > From: Sudarsan Raghavan <[EMAIL PROTECTED]> > Organization: HP ISO > To: "John W. Krahn" <[EMAIL PROTECTED]> >

[Fwd: Re: Help with parsing output] (forgot to post to the list)

2002-05-30 Thread Sudarsan Raghavan
Original Message Subject: Re: Help with parsing output Date: Fri, 31 May 2002 11:07:16 +0530 From: Sudarsan Raghavan <[EMAIL PROTECTED]> Organization: HP ISO To: "John W. Krahn" <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> <[EMAIL PROTECT

Re: Help with parsing output

2002-05-30 Thread Sudarsan Raghavan
"Kipp, James" wrote: > > > > # INPUTDATA is the filehandle through which you are getting the input > > while () { > > chomp; > > s/^\s+//; > > next if (m/^$/ || (1 .. /^NPROC/)); > > >what does the range thing do? > >wouldn't just ... || /^NPROC/ be enough? > > I think that is how h

Re: Help with parsing output

2002-05-30 Thread bob ackerman
On Thursday, May 30, 2002, at 02:53 PM, bob ackerman wrote: > > On Thursday, May 30, 2002, at 11:20 AM, David Gray wrote: > > while () { > chomp; > s/^\s+//; > next if (m/^$/ || (1 .. /^NPROC/)); what does the range thing do? wouldn't just ... || /^NP

Re: Help with parsing output

2002-05-30 Thread bob ackerman
On Thursday, May 30, 2002, at 11:20 AM, David Gray wrote: while () { chomp; s/^\s+//; next if (m/^$/ || (1 .. /^NPROC/)); >>> >>> what does the range thing do? >>> wouldn't just ... || /^NPROC/ be enough? >> >> ok. opposite sense: || ! /^NPROC/ > > So that wo

Re: Help with parsing output

2002-05-30 Thread drieux
On Thursday, May 30, 2002, at 10:42 , Kipp, James wrote: as for why I do old dog flag tricks - to be honest - they make me feel safer I know that i will not even look at anything, and I get the 'freebie' of not needing to deal with a RegEx resolution - which I think is more expensive - and I

RE: Help with parsing output

2002-05-30 Thread David Gray
> >> while () { > >> chomp; > >> s/^\s+//; > >> next if (m/^$/ || (1 .. /^NPROC/)); > > > > what does the range thing do? > > wouldn't just ... || /^NPROC/ be enough? > > ok. opposite sense: || ! /^NPROC/ So that would be: next if (m/^$/ || ! /^NPROC/); Which means skip proces

Re: Help with parsing output

2002-05-30 Thread John W. Krahn
Sudarsan Raghavan wrote: > > "Kipp, James" wrote: > > > I am reading output from a pipe to a command called 'prstat' (like top). > > just wanted to get some ideas on the best way to capture the data i am > > looking for. below is an example of the output: > > # INPUTDATA is the filehandle throu

RE: Help with parsing output

2002-05-30 Thread Kipp, James
> thanks. question: why the counter in your code example? <> yes, i understand that, i guess the question should have been, why do we need it? why not just do a next unless /REGEX/ then if /$find/ > > hmm..guess i should have scoured the man page before posting the question. > tur

Re: Help with parsing output

2002-05-30 Thread bob ackerman
On Thursday, May 30, 2002, at 09:44 AM, bob ackerman wrote: > > On Thursday, May 30, 2002, at 07:31 AM, Sudarsan Raghavan wrote: > >> "Kipp, James" wrote: >> >>> I am reading output from a pipe to a command called 'prstat' (like top) >>> . >>> just wanted to get some ideas on the best way to c

Re: Help with parsing output

2002-05-30 Thread drieux
On Thursday, May 30, 2002, at 08:04 , Kipp, James wrote: > thanks. question: why the counter in your code example? I presume you mean the '$readIt++' - that is not really a counter, more just a boolean flag We set it to zero and once we see that the /$RightHeader/ we flip it on and get the

RE: Help with parsing output

2002-05-30 Thread Kipp, James
> > # INPUTDATA is the filehandle through which you are getting the input > while () { > chomp; > s/^\s+//; > next if (m/^$/ || (1 .. /^NPROC/)); >what does the range thing do? >wouldn't just ... || /^NPROC/ be enough? I think that is how he eliminates lines up to the NPROC line. s

Re: Help with parsing output

2002-05-30 Thread bob ackerman
On Thursday, May 30, 2002, at 07:31 AM, Sudarsan Raghavan wrote: > "Kipp, James" wrote: > >> I am reading output from a pipe to a command called 'prstat' (like top). >> just wanted to get some ideas on the best way to capture the data i am >> looking for. below is an example of the output: > >

RE: Help with parsing output

2002-05-30 Thread Kipp, James
: drieux [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 10:30 AM To: Kipp, James Cc: Perl Subject: Re: Help with parsing output On Thursday, May 30, 2002, at 06:55 , Kipp, James wrote: > NPROC USERNAME SIZE RSS MEMORY TIME CPU that is the trick throwing away everything before

RE: Help with parsing output

2002-05-30 Thread Kipp, James
Thanks. Clever slice with the split line. -Original Message- From: Sudarsan Raghavan [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 30, 2002 10:31 AM To: Kipp, James Cc: Perl Subject: Re: Help with parsing output "Kipp, James" wrote: > I am reading output from a pipe

Re: Help with parsing output

2002-05-30 Thread Sudarsan Raghavan
"Kipp, James" wrote: > I am reading output from a pipe to a command called 'prstat' (like top). > just wanted to get some ideas on the best way to capture the data i am > looking for. below is an example of the output: # INPUTDATA is the filehandle through which you are getting the input while (

Re: Help with parsing output

2002-05-30 Thread drieux
On Thursday, May 30, 2002, at 06:55 , Kipp, James wrote: > NPROC USERNAME SIZE RSS MEMORY TIME CPU that is the trick throwing away everything before this line, and then doing a basic regEx on the stuff after it: cf: http://www.wetware.com/drieux/pbl/Sys/Admin/prstatFilter.txt persona

Help with parsing output

2002-05-30 Thread Kipp, James
I am reading output from a pipe to a command called 'prstat' (like top). just wanted to get some ideas on the best way to capture the data i am looking for. below is an example of the output: -- PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP 13261 prago5728K 5240K cp

parsing output

2002-01-29 Thread Duarte Cordeiro
Helo, this is my first try with perl. I've programmed mainly in C-style languages and lisp, and I know that my code isn't very "perl-like". So, can somebody enlight me of a better way to right this ? Thanks for your time, Duarte Problem: Write a program that receives two arguments: a ip ad