Revision 99

Date:
2009/05/25 21:15:25
Author:
dpavlin
Revision Log:
parse last line of every */*.np file
Files:

Legend:

 
Added
 
Removed
 
Modified
  • recepies/netpipe-tcp/np2graphviz.pl

     
    1 #!/usr/bin/perl
    2
    3 use warnings;
    4 use strict;
    5
    6 foreach my $file ( glob '*/*.np' ) {
    7
    8 my $direction = $file;
    9 $direction =~ s/\.np$//;
    10 my ( $from, $to ) = split(m{/},$direction,2);
    11
    12 my $line = `tail -1 $file`;
    13 $line =~ s{^\s+}{};
    14 $line =~ s{\s+$}{};
    15 my ( $size, $speed, $rtt ) = split(/\s+/, $line);
    16
    17 warn "$from -> $to | $size | $speed | $rtt\n";
    18 }
    19
    20
    21