From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: dominik.vogt@gmx.de, zsh-users@sunsite.auc.dk
Subject: Re: displaying top cpu using process
Date: Sun, 8 Apr 2001 17:04:06 +0000 [thread overview]
Message-ID: <1010408170406.ZM16984@candle.brasslantern.com> (raw)
In-Reply-To: <20010408144946.A640@gmx.de>
On Apr 8, 2:49pm, Dominik Vogt wrote:
} Subject: Re: displaying top cpu using process
}
} > LINES=10 COLUMNS=200 top d 2 c b n 43200 |
} > while read pid user pri ni size rss share stat lib cpu mem time command
}
} 525 luthien 13 5 1148 1148 932 S N 0.0 0.9 0:00 startx
} ^^^
Urk, I forgot about that. Your solution is probably the best for this
particular applicaton, but in case you actually want to parse it:
... | while read pid user pri ni size rss share stat rest
do
rest=($=rest)
[[ $rest[1] == <->* ]] || { stat="$stat $rest[1]" ; shift rest }
lib=$rest[1] # Your output does not have this item? Renumber.
cpu=$rest[2]
mem=$rest[3]
time=$rest[4]
command=$rest[5,-1]
...
done
I don't think top ever produces more than 2 words in the STAT column,
does it?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
prev parent reply other threads:[~2001-04-08 17:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-07 14:33 Dominik Vogt
2001-04-07 18:26 ` Bart Schaefer
2001-04-08 12:49 ` Dominik Vogt
2001-04-08 17:04 ` Bart Schaefer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1010408170406.ZM16984@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=dominik.vogt@gmx.de \
--cc=zsh-users@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).