#!/usr/bin/perl; use strict; use warnings; my $filename = $ARGV[0]; my $debug = $ARGV1; die "\n\tUSAGE: perl $0 output debug\n\n" unless $ARGV[0]; die "\n\tERROR: Cannot find the file $ARGV[0]\n\n" unless -e $ARGV[0]; open(IN,$filename); my $ids; while($filename){ chomp; if(/(ID=.+)$/){ if(++$ids{$1} > 1){ say $_, $ids{$1}; next; } } say; } print say;