Re: join two files

"Ruud H.G. van Tol" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
With autosplit:

     perl -awlne'
         BEGIN{%h=`cat ./file1`=~/(.*?);(.*)/g}
         print"$_ ",$h{$F[0]}||"N\/A"
     ' ./file2

The BEGIN-block parses file1 into a hash. The print-line postfixes each 
row from file2 with the extra info.

See `perldoc perlrun` about autosplit.

-- 
Ruud
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.