Hi Im supposed to compare lines in a file :
KB0005 1019 T IFVATVPVI 0.691 PKC YES
KB0005 1036 T YFLQTSQQL 0.785 PKC YES
KB0005 1037 S FLQTSQQLK 0.585 DNAPK YES
KB0005 1045 S KQLESEGRS 0.669 PKC YES
KB0005 1045 S KQLESEGRS 0.880 unsp YES
KB204320 1019 T IFVATVPVI 0.699 PKC YES
KB204320 1036 T YFLQTSQQL 0.789 PKC YES
KB204320 1037 S FLQTSQQLK 0.589 DNAPK YES
KB204320 1045 S KQLESEGRS 0.880 unsp YES
and print the lines that differs or dont repeat, which i managed to do by first putting lines into 2 arrays (the lines differ in names KB0005 and KB204320) and then by writing a perl script: Code:
foreach $item (@a1, @a2) { $count{$item}++;}
foreach $item (keys %count) {
if ($count{$item} == 2) {
next;
} else {
push @diff, $item;
}
}
my @sorted =sort @diff;
#print "\nIntersect Array = @isect\n";
foreach my $el(@sorted){
print "$el\n";
}
OUTPUT:
1019 T IFVATVPVI 0.691 PKC
1019 T IFVATVPVI 0.699 PKC
1036 T YFLQTSQQL 0.785 PKC
1036 T YFLQTSQQL 0.789 PKC
1037 S FLQTSQQLK 0.585 DNAPK
1037 S FLQTSQQLK 0.589 DNAPK
1045 S KQLESEGRS 0.669 PKC
This works good, I just want to print from which line (KB005 or the other) a given line comes from..
Anybody's willing to help? Thx