fileA
A,B,C,D
fileB
A,E,F,G,H
New File (fileC)
A,B,D,G
####
#!/usr/bin/perl
use strict;
use warnings;
my %scanned=();
my %import=();
my @LIST=();
open(SCAN, "scan3.txt") || die "$!\n";
while () {
my ( $machine, $luser, $hacked, $privel, undef ) =
split(/,/,$_);
$scanned{$machine}=[ $luser, $hacked, $privel ];
}
close (SCAN);
open(IMPORT, "importtodb.csv") || die "$!\n";
while () {
my ( $machine, $user, undef, undef, undef, undef, $locale, undef ) =
split(/,/,$_);
$import{$machine}=[ $user, $locale ];
}
close (IMPORT);
foreach my $machine (keys(%scanned)) {
if(exists($scanned{$machine})) {
push(@LIST, $machine);
}
}
foreach my $item(@LIST){
print "$item\n";
}
####
$machine,$luser,$user,$hacked,$locale