in reply to Obtaining data from the top command via a pipe

Sorry guys, but the problem is that top prints the page without the line for the CPU states, leaving that line blank. Then it has to do screen cursor positioning to update that line in realtime. But the first time it tries, it discovers that that the pipe to which you are directing output cannot accept ANSI escape sequences (needed to position the cursor) so it exits before that point.

Piping to tee doesn't work either because then tee has access to the screen device but top still hasn't got it and exits just as quickly leaving tee to duplicate the same problem.

Update: Perhaps something like Test::Expect will be able to emulate an ANSI terminal to top's satisfaction.

One world, one people

  • Comment on Re: Obtaining data from the top command via a pipe