Do something like that for the first file, then you can do something like this:my %file1_row_for; while (my $input = <THAT_FILE>){ # only grab column 2 my ( undef, $id ) = split /;/, $input; my $file1_row_for{$id} = $input; }
To generate your output. One other question, though: is there a possibility that there will be more than one matching row in the second file? Even if you think there isn't, you should probably write your code to either process that in a particular manner (output two lines?) or to die if it runs into that scenario.while ( my $input = <THAT_OTHER_FILE> ){ my ( $id2 ) = split /;/, $input; print OUTFILE $input print OUTFILE ';' . $file1_row_for{$id2} if defined $file1_row_for +{$id2} print OUTFILE "\n"; }
perl -e 'split//,q{john hurl, pest caretaker}and(map{print @_[$_]}(joi +n(q{},map{sprintf(qq{%010u},$_)}(2**2*307*4993,5*101*641*5261,7*59*79 +*36997,13*17*71*45131,3**2*67*89*167*181))=~/\d{2}/g));'
In reply to Re: concatenation of lines from two different files
by agianni
in thread concatenation of lines from two different files
by steph_bow
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |