perlnoobster has asked for the wisdom of the Perl Monks concerning the following question:
use warnings; use strict; my $A_file = 'A.txt'; my $B = 'B.txt'; my $matches ='matches.txt'; open (INPUT, $A_file) or die "ERROR: cannot find file $A_file\n"; open (OUT2, ">$matches"); while (<INPUT>) { my @text1=(); @text1 = split /\t/,$_; chomp @text1; next if ($text1[0]=~ /L1/gi); open (OUT1, "$B"); while(<OUT1>) { my @textpac=(); @textpac = split /\t/,$_; chomp @textpac; next if ($textpac[0]=~ /OID/gi); if($textpac[3] eq $text1[0] && $textpac[11] eq $text1[11]) + { print OUT2 join( "\t", @text1[ 1, 2, 3 ] ), "\n"; } } } close ($A_file); close OUT1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Comparing two text files
by davido (Cardinal) on Jan 07, 2013 at 17:40 UTC | |
|
Re: Comparing two text files
by CountZero (Bishop) on Jan 07, 2013 at 20:56 UTC | |
|
Re: Comparing two text files
by space_monk (Chaplain) on Jan 08, 2013 at 11:51 UTC | |
by perlnoobster (Sexton) on Jan 08, 2013 at 17:25 UTC | |
|
Re: Comparing two text files
by Anonymous Monk on Jan 08, 2013 at 03:46 UTC |