##
$ ./myfilter -i file_a file_b
####
while () {
if ( this is a line i want ) {
s/[\015\012]+$//; # Just to remove any CR/LF
my($router,$site)= split /,/,$_,3;
$replace{$router}= $site;
}
}
my $replacements= '\b('.join('|',keys %router).')\b';
## ##
my $symbol;
while (<>) {
if (my $hit/^SYMBOL: $replacements/i ... /^END SYMBOL/i) {
if ($hit==1) {
$symbol=$1;
}
else {
s/^(Parent Submap:).*/$1 $replace{$symbol}/;
}
}
print;
}