From e840b0a696406ccc079fbc1902837280b30e224e Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 28 May 2012 14:25:51 +0200 Subject: [PATCH] Add a script to correlate sender and receiver logs. --- correlate.pl | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 correlate.pl diff --git a/correlate.pl b/correlate.pl new file mode 100755 index 0000000..04cc9d4 --- /dev/null +++ b/correlate.pl @@ -0,0 +1,36 @@ +#! /usr/bin/perl + +use strict; +use warnings; + +my $fh; +my %seen_recv = (); + +# Receiver +open $fh, "<", $ARGV[1] + or die "$ARGV[1]: $!"; +while (<$fh>) { + tr/\r\n//d; + /^(\d+)$/ or next; + $seen_recv{$1} = 1; +} +close $fh; + +# Sender +open $fh, "<", $ARGV[0] + or die "$ARGV[0]: $!"; +while (<$fh>) { + tr/\r\n//d; + /^\d+(?: \d+)* $/ or next; + for my $n (split) { + if (exists($seen_recv{$n})) { + print "$n "; + } else { + print "$n* "; + } + } + print "\n"; +} +close $fh; + + -- 2.39.2