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
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
>
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/) {
>
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
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
"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
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
> < ...
> 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.
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]>
>
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
"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
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
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
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
> >> 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
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
> 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
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
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
>
> # 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
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:
>
>
: 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
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
"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 (
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
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
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
27 matches
Mail list logo