easy with hashes.
#untested
my %hash1;
my %hash2;
open(FILE1, $file1) || die "Can't open $file1 :
$!\n";
foreach my $line (<FILE1>)
{
chomp($line); my @line = split(/ +/,$line);
my $key = $line[0];
$hash1{$key} = join(" ",@line);
}
close(FILE1);
open(FILE2, $file2) || die "Can't open $file2 :
$!\n";
foreach my $line (<FILE1>)
{
chomp($line);
my @line = split(/ +/,$line);
my $key = $line[0];
$hash2{$key} = join(" ",@line);
}
close(FILE2);
foreach my $key (keys %hash1)
{
print "$key $hash1{$key}
$hash2{$key}\n";
}
|
Title: RE: Terrible at my logic
- merging two tabseparated text files. Mohanty, Debi \(MED, TCS\)
- RE: merging two tabseparated text files. FARRINGTON, RYAN
- RE: merging two tabseparated text files. Peter Eisengrein
- RE: merging two tabseparated text files. Mohanty, Debi \(MED, TCS\)