-#!/usr/bin/perl -w
-
-#
-# This script detects handshake patterns
-# and changes channel numbers for host names
-#
-#0_05_01_981_298 node309 #45 +hs f33dff82
-#0_05_02_039_313 lossy #16 -hs f33dff82
-my %HSSRC = ();
-my %CH = ();
-
-while (<>) {
- / (\S+) (\#\d+)/ || next;
- my $src = $1;
- my $ch = $2;
- if ( exists $CH{"$src$ch"} ){
- s/$ch/$CH{"$src$ch"}$ch/ or die $_;
- } elsif (/[\+\-]hs ([a-f0-9]+)$/) {
- if ( exists $HSSRC{$1} ) {
- $CH{"$src$ch"} = $HSSRC{$1};
- my $srckey = $HSSRC{$1}.$HSSRCCH{$1};
- $CH{$srckey} = $src;
- } else {
- $HSSRC{$1} = $src;
- $HSSRCCH{$1} = $ch;
- }
- }
- print;
-}