O que você quer fazer requer um pouco de programação:
#!/usr/bin/perl
# Program to join files of TAB separated data based on first key
# --J. Ziobro--: 11/2014
use strict;
my $f;
my %allLines;
my $maxColumns = 0;
my $fileNum = 0;
my %keys;
foreach $f (@ARGV) {
die "Could not open $f" unless open( F, $f );
while (<F>) {
chop;
my ( $key, @line ) = split /\t/; # assume tab separate all cols
$maxColumns = ( $maxColumns > @line ) ? $maxColumns : @line;
# allLines is indexed by KEY <tab> FileNumber
$keys{$key} = 1;
$allLines{ $key . "\t" . $fileNum } = join( "\t", @line );
}
$fileNum++;
}
foreach ( keys %keys ) {
print $_;
for ( $f = 0 ; $f < $fileNum ; $f++ ) {
if ( exists $allLines{ $_ . "\t" . $f } ) {
print "\t", $allLines{ $_ . "\t" . $f };
}
else {
print " " x $maxColumns;
}
}
print "\n";
}
Ciao, // Z \