Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Substitute text string in a file with matching text from another file

by davidrw (Prior)
on Aug 12, 2005 at 15:40 UTC ( [id://483310]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sort f1 | perl -pe 's/\|/~~/' > f1~
    sort f2 | perl -pe 's/\|/~~/' > f2~
    join -t'|' -a 1 -a 2 f2~ f1~ \
             | perl -pe 's/~~/|/' \
             | perl -F'/\|/' -ape 's/$/|NO MATCH/ unless $#F==3; $_'
    
  2. or download this
      SELECT f2.A, f2.B, f2.C, COALESCE(f1.C, 'NO MATCH') as D
      FROM f2 LEFT JOIN f1 ON f1.A = f2.A AND f1.B = f2.B
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://483310]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-23 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found