From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4709 invoked from network); 8 Apr 2001 17:04:50 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 8 Apr 2001 17:04:50 -0000 Received: (qmail 22355 invoked by alias); 8 Apr 2001 17:04:38 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3812 Received: (qmail 22343 invoked from network); 8 Apr 2001 17:04:37 -0000 From: "Bart Schaefer" Message-Id: <1010408170406.ZM16984@candle.brasslantern.com> Date: Sun, 8 Apr 2001 17:04:06 +0000 In-Reply-To: <20010408144946.A640@gmx.de> Comments: In reply to Dominik Vogt "Re: displaying top cpu using process" (Apr 8, 2:49pm) References: <20010407163348.A619@gmx.de> <1010407182602.ZM15804@candle.brasslantern.com> <20010408144946.A640@gmx.de> X-Mailer: Z-Mail (5.0.0 30July97) To: dominik.vogt@gmx.de, zsh-users@sunsite.auc.dk Subject: Re: displaying top cpu using process MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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