open(FILE,"txt2.txt") or die $!; while(){ if($_ =~/(\S+)\t(\S+)\t(\S+)\t(\S+)\t(\S+)/ || $_ =~/number=(\S+)/){ print "$1\t$2\t$3\t$4\t$5\t$6\t"; } }