perl把第一列有重复的行提取出来的代码,供大家学习参考。
#!/usr/bin/perl
use warnings;
use strict;
open(ONE,"$ARGV[0]") or die $!;
open(ONE,"$ARGV[0]") or die $!;
my (%h1 ,%h2);
my @a;
my @b;
while (<ONE>) {
chomp;
@a=split/t/;
$x=join"t", $a[1],$a[2],$a[3];
$h1{$x}=$a[0];
$h2{$a[0]}++;
}
while (<TWO>){
chomp;
@b=split/t/;
print "$_n" if $h2{$b[0]} >=2;
}