a.txt:
LOCK xxx yyy 123 1.1 fff
LOCK nnj hhh 789 2.2 uuu
####
b.txt:
LOCK xxx yyy 567 1.1 fff
LOCK nnj hhh 000 2.2 uuu
LOCK YUI hhh 520 2.3 ujk
####
my @files = ($file,$file1);
open(INOUT1,"<", $file1) or die "cant open output file ";
while ($linea = ){
open(INOUT,"<", $file) or die "cant open output file";
while ($line = ){
chomp $linea;
next unless $linea =~ m/^LOCK /;
chomp $line;
next unless $line =~ m/^LOCK /;
foreach $file_n (@files){
$old = $files[0];
$new = $files[1];
if ($old eq $file_n){
@words=split(/\s+/,$line);
$feature1[$i]=$words[1];
$ver1[$i]=$words[3];
$exp1[$i]=$words[4];
$no1[$i]=$words[5];
$i++;
}
else{
@words=split(/\s+/,$linea);
$feature2[$ii]=$words[1];
$ver2[$ii]=$words[3];
$exp2[$ii]=$words[4];
$no2[$ii]=$words[5];
$ii++;
}
}
}close INOUT;
}close INOUT1;
print "
for ($b=0;$b<@feature1;$b++)
{ $test=0;
for($a=0;$a<@feature2;$a++)
{
if($feature1[$b] ne $feature2[$a])
{
$test++;
}
if($test == @feature2)
{
print "| $feature1[$b] | $ver1[$b] | $exp1[$b] | $no1[$b] |
";
#$test++;
}
}
}
print "
";
print "
for ($b=0;$b<@feature2;$b++)
{ $test=0;
for($a=0;$a<@feature1;$a++)
{
if($feature2[$b] ne $feature1[$a])
{
$test++;
}
if($test == @feature1)
{ #print $test;
print "| $feature2[$b] | $ver2[$b] | $exp2[$b] | $no2[$b] |
";
}
}
}
print "
";}