Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Joining two files on common field

by davidrw (Prior)
on Sep 22, 2005 at 21:59 UTC ( [id://494317]=note: print w/replies, xml ) Need Help??


in reply to Joining two files on common field

if it suits your needs, you can simply do this on the commandline with join as well:
[davidrw@host davidrw]$ join -t , -1 1 -2 4 /tmp/f1 /tmp/f2 upc,qty,product_sku,size,color 840197083284,2,121,LG,Black 840197083291,3,121,XL,Black 840197083307,21,121,2XL,Black
see "man join" for the various options to get the output the way you need it (espically if you want to show unmatched lines)

Replies are listed 'Best First'.
Re^2: Joining two files on common field
by ambrus (Abbot) on Apr 12, 2006 at 12:59 UTC
Re^2: Joining two files on common field
by ch1 (Novice) on Sep 22, 2005 at 23:01 UTC
    I tried join first... well becasue it should have been easy but it returns no output.
      what were your attempts? I got nothing at first because i didn't specifiy the comma delimiter with -t (default is tab)... what i posted above worked and that was the actual output... worth a quick glance of the man page in case the params are slightly different for your system?
        Well.... If I type a few lines of each file out manually, the join works. Otherwise the join returns nothing. In vi I've used the set list to check for special character but there isn't any.
        Any idea what could be causing the problem?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-03-29 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found