File 1,
1141286452,ServerA,Disk Full,Arb data,other,stuff
1141286737,ServerB,Net Down,Arb data,other,stuff
1141286737,ServerC,Disk Full,Arb data,other,stuff
File2,
1141286737,ServerB,Net Down
1141286780,ServerD,Bit Bucket Missing
####
File 1,
1141286452,ServerA,Disk Full
1141286737,ServerB,Net Down
1141286737,ServerC,Disk Full
File2,
1141286737,ServerB,Net Down
1141286780,ServerD,Bit Bucket Missing
##
##
my %index;
foreach my $entry (@file1) {
if (not exists $index{$entry}) {
$index{$entry} = 1
}
}
foreach my $entry (@file2) {
if (not exists $index{$entry}) {
$index{$entry} = 2
}
else {
$index{$entry} += 2;
}
}
foreach my $entry (keys %index) {
if ($index{$entry} == 1) {
print "Entry $entry is only in file one\n";
}
elsif ($index{$entry} == 2) {
print "Entry $entry is only in file two\n";
}
elsif ($index{$entry} == 3) {
print "Entry $entry is in both files\n";
}
else {
print "Entry $entry is screwed up!\n";
}
}