mrc has asked for the wisdom of the Perl Monks concerning the following question:

Is there a perl module that automatically parse shell output and sort the lines in a human readable manner? I capture the output into a file, but it looks like
M8.93kb 3.6 275 985k +3kb 10 195991kB 253kb 60.3 155[10;52 +H43kB 23.6kb 14.4937kB 47.0kb 10.2kb 127 71.11.11.18<=> 111.121.121.121619kB 1.13Mb 495 +kb 124kb 0
On the screen I have the lines looking like
69.11.11.11 + <=> 222.11.12.13 + 31.1kB 23.5kb 31.1kb 31.1kb
This is coming from iftop command.

Replies are listed 'Best First'.
Re: perl sorting shell output
by hdb (Monsignor) on Apr 23, 2013 at 07:26 UTC

    iftop is a command that continuously updates its display and as such not well suited to be read from a script. There might be a command line switch to generate a one-off display??

      I'm able to capture the output, because after some time I kill the pid.

        iftop has a -b switch that suppresses the bars showing network load. Have you tried that? I have no *nix box at hand and cannot try myself.