#!/your/perl -w use strict; my($line_count, %dup)=0; while () { my ($test, $id, undef, $key)=split /,\s*|\(/, $_, 5; next unless $test=/PROBABLECAUSE\w*/; # If i may be so bold... $key = lc $key; if (exists $dup{$key}) { print "Duplicates found\n"; print "$dup{$key}->[0]: $dup{$key}->[1]"; print "$line_count: $_"; } else { $dup{$key}=[$line_count, $_]; # store No and line } $line_count++; }