in reply to Piping top
also if you try those piping methods again and wait for a really really long time (like 3 or 4 minutes) you will eventually get output. not sure what the deal is exactly there. guess the buffer isn't flushing? often? or something? for example, try top -b | grep "CPU states | less and wait for a while. it will eventually come up with some output.#!/usr/bin/perl -w use strict; use IPC::Open2; $|=1; open2( my $read, my $write, "top -b" ); while( <$read> ) { print if /CPU states/ ; }
|
|---|