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