tc1364 has asked for the wisdom of the Perl Monks concerning the following question:
The output looks like the below currently.#!/usr/bin/perl open PIPE, "/usr/local/bin/top -b -n 3 |" or die "Cannot open"; my $output = join '', <PIPE>; close PIPE or die "Running top failed"; print "$output\n"; exit(0);
load averages: 0.26, 0.24, 0.30 16:02:45 171 processes: 168 sleeping, 1 running, 1 zombie, 1 on cpu Memory: 1024M real, 767M free, 92M swap in use, 1732M swap free PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND 6451 pc2587 1 11 0 984K 704K sleep 0:26 5.36% br 5983 dw3586 1 48 0 984K 704K sleep 1:19 0.35% br 5962 dw3586 1 48 0 984K 704K sleep 1:39 0.35% br
Edited by Arunbear: Changed title from 'PIPE', as per Monastery guidelines; and added code tags around output.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Obtaining data from the top command via a pipe
by Tanktalus (Canon) on Aug 08, 2005 at 21:21 UTC | |
|
Re: Obtaining data from the top command via a pipe
by davidrw (Prior) on Aug 08, 2005 at 21:48 UTC | |
|
Re: Obtaining data from the top command via a pipe
by AReed (Pilgrim) on Aug 08, 2005 at 21:46 UTC | |
by tc1364 (Beadle) on Aug 10, 2005 at 14:03 UTC | |
|
Re: Obtaining data from the top command via a pipe
by anonymized user 468275 (Curate) on Aug 09, 2005 at 13:33 UTC |