Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

Join Command

UNIX for Dummies Questions & Answers


 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-10-2013
satyar satyar is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 24 January 2013, 9:15 AM EST
Posts: 7
Thanks: 3
Thanked 0 Times in 0 Posts
Join Command

Hi,
Please explain the working process of join command.

File 1

Code:
P B
S A
C A

File2

Code:
C B
P A
S D

But the output of join command is...
join File1.txt File2.txt

Code:
P B A
S A D

But I guess the output should be

Code:
P B A
S A D
C A B

Please correct me,if i am worong or missing some thing.

Thanks
Sponsored Links
    #2  
Old Unix and Linux 01-10-2013
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 4 December 2016, 4:41 AM EST
Location: San Jose, CA, USA
Posts: 9,723
Thanks: 459
Thanked 3,320 Times in 2,840 Posts
To work correctly, both files being joined need to be sorted on the fields that are to be used as the matching fields. Since File 1 has the values in the order

Code:
P
S
C

instead of

Code:
C
P
S

for the field used to match for the join, the results are unspecified.
The Following User Says Thank You to Don Cragun For This Useful Post:
satyar (01-10-2013)
Sponsored Links
    #3  
Old Unix and Linux 01-10-2013
satyar satyar is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 24 January 2013, 9:15 AM EST
Posts: 7
Thanks: 3
Thanked 0 Times in 0 Posts
Thanks a lot...it worked Linux
Sponsored Links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to use the the join command to join multiple files by a common column evelibertine UNIX for Dummies Questions & Answers 5 07-05-2012 05:15 PM
how to join two files using "Join" command with one common field in this problem? mindfreak UNIX for Dummies Questions & Answers 2 04-13-2012 06:55 AM
awk command for simple join command but based on 2 columns ruby_sgp Shell Programming and Scripting 2 03-28-2010 08:00 AM
Join command Mish_99 Shell Programming and Scripting 1 10-24-2008 12:27 PM
join (pls help on join command) summer_cherry Shell Programming and Scripting 1 12-31-2007 05:19 AM



All times are GMT -4. The time now is 02:16 PM.