####
exfields.pl file1.gz name,ipAdd,DestDev
####
"atlanta" "192.168.1.1" "vienna"
"miami" "192.168.1.2" "dallas"
"nyc4" "192.168.1.3" "boston"
####
exfields.pl file2.gz name,ifSpeed
####
"atlanta" "622000000"
"miami" "155000000"
"nyc4" "155000000"
####
"atlanta" "192.168.1.1" "vienna" "622000000"
"miami" "192.168.1.2" "dallas" "155000000"
"nyc4" "192.168.1.3" "boston" "155000000"
####
#!/usr/local/bin/perl -w
## merge.pl
use strict;
if ($ARGV[3] ne "") {
my $file1 = $ARGV[0];
my $list1 = join (",", $ARGV[1]);
my $file2 = $ARGV[2];
my $list2 = join (",", $ARGV[3]);
my %hash_1 = process($file1, $list1);
my %hash_2 = process($file2, $list2);
}else {
print "merge.pl - Usage: file field(s) file field(s)\n";
}
sub process {
my ($file, $list) = @_;
my $script = "perl /home/limo/Perl/exfields.pl -e";
my %hash;
my $arg;
for $arg (split /,/ => $list) {
open(FILE, "$script $arg $file |") or die "System error: $!\n";
while () {
next if /^(#|none|unkno)/i;
chomp;
push @{ $hash{$arg} }, split;
}
close FILE;
}
return %hash;
}
####
####
####