my $i=0;
my %p;

foreach my $f (@ARGV) {

    $i++;
    open (F, $f);
    
    my $j;
    while (<F>) {
	$j++;
	next unless (/.{20,}/);

	my $id;
	if (s/^\[(\d+-\d+) ?|?\] //) { $id = $1 }
	else {
	    if ($f =~ m/(\w+)\.txt/) { $f = $1 }
	    $id = $f . "_" . $j;
	}


	s/^\s*//;
	s/\s*$//;

	if ($p{$_}) { my $a = $p{$_}; push @$a, $id; $p{$_} = $a }
	else { $p{$_} = [$id] }
	
    }

    close F;

}

while (my ($txt,$ar) = each %p) {

    next if (@$ar < 2);
    print join ("||", @$ar), " --- ", $txt, "\n";

}



