Re: join two files

"Ruud H.G. van Tol" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
On 16/05/2013 14:08, Ruud H.G. van Tol wrote:

> perl -wpe '
>     BEGIN{%h=map{split/\s*;\s*/}`cat ./file1`}
>     s/((\S+).*)/"$1 ".($h{$2}||"N\/A")/e
> ' ./file2

Alternatives:

   perl -wpe '
       BEGIN{%h=`cat ./file1`=~/(\w+)\W+(\w+)/g}
       s/((\S+).*)/"$1 ".($h{$2}||"N\/A")/e
' ./file2

   perl -wpe '
       BEGIN{%h=`cat ./file1`=~/(.*?);(.*)/g}
       s/((\S+).*)/"$1 ".($h{$2}||"N\/A")/e
' ./file2

-- 
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.