![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| join two files | koti_rama | Shell Programming and Scripting | 5 | 3 Weeks Ago 01:20 AM |
| awk, join or sed | jkl_jkl | Shell Programming and Scripting | 1 | 04-15-2008 02:55 AM |
| join (pls help on join command) | summer_cherry | Shell Programming and Scripting | 1 | 12-31-2007 01:19 AM |
| Join help with -e option | Ken555 | UNIX for Dummies Questions & Answers | 2 | 08-21-2006 07:50 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Join
Hi,
Is there a way to get join to join 2 files even if in one file one of the records does not exist? i.e. 1st file aaa 50 bbb 60 2nd file aaa 40 So i want to join the 2 files together and get the following output: aaa 50 aaa 40 bbb 60 bbb 0 Is this possible??? Thanks Jason |
| Forum Sponsor | ||
|
|
|
|||
|
join
Thanks drl for throwing the lights on the subject , but as far as SCO-UNIX,
UNIX-VER5 are concerned I have experimented and found that if the length is not equal of the field on which you wanted to join , it fails , same on RedHat-9 too. Correct me if I am wrong , b'Coz on many occassion I have seen if the file say if you want to join on strings and the same is not sorted on -d order or digit not sorted on -n order and the likewise it gave me NIL output. But would like to have your suggestion too . Alwasy ready to LEARN new things. Thanx in advance to discuss on the subject. |
|
||||
|
Hi, vakharia Mahesh.
I think we may be talking about different lengths. I was talking about the length of the files which might be different if it is the case that "one of the records does not exist" as the OP wrote. I agree that the fields need to be the same length in characters, and the files need to be sorted on the fields to be joined. If the fields are not the same length, then one would need to do some pre-and-post processing to add extra fields, join, remove extra fields. One could also create an awk or perl script for such special cases. Best wishes ... cheers, drl |