From `man top`:while (1) { my $top_output = `top -l 1`; do_something_with( $top_output ); sleep 5; }
-l <samples>
Use logging mode and display <samples> samples, even if standard output is a terminal. 0 is treated as infinity. Rather than redisplaying, output is periodically printed in raw form.
In reply to Re: Capturing top-like program output
by Util
in thread Capturing top-like program output
by Alien
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |