The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
join two files koti_rama Shell Programming and Scripting 5 08-05-2008 01:20 AM
Join two files koti_rama Shell Programming and Scripting 4 06-10-2008 03:15 AM
how to join files jxh461 UNIX for Dummies Questions & Answers 5 08-23-2007 04:11 AM
Sum of Files Sizes starting with a letter... pbsrinivas Shell Programming and Scripting 2 07-25-2007 05:21 AM
Join Files choppas Shell Programming and Scripting 2 10-18-2006 07:03 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-23-2008
Registered User
 

Join Date: Jan 2008
Posts: 2
Join - files of different sizes

I am trying to join to files with dramatically different sizes (file 1: 1 column - 9000 rows, file 2: 13 cols, 26 million rows). I can't seem to get join to work. I have check to ensure that there are matches and have tried subsamples that work. The -a filenum flag lists all the rows, so join is indeed doing something. Is there a reason that disproportionate files will not join?
Cheers!
Reply With Quote
Forum Sponsor
  #2  
Old 01-23-2008
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
If both files are sorted in the same collating sequence and the same direction for the key fields, you do get output regardless of a disparity in size.

If there is no match for an item in file1, you get no output.

Is there a possibility of producing cartesian products in the result set?
What status code does join return?
Code:
join file1 file2 
......
echo $?
Reply With Quote
  #3  
Old 01-23-2008
Registered User
 

Join Date: Jan 2008
Posts: 2
Join - files of different sizes

Right, so my files are sorted in (numerical ) order on the field that is being joined (1). The result of the join is 0. That is:
Code:
$ join -1 1 -2 1 File1 File2
$ echo $?
0
It seems that the file size difference is responsible, but I can't explain why. Or perhaps there is some other reason.
Cheers!
Reply With Quote
  #4  
Old 01-26-2008
Registered User
 

Join Date: Feb 2007
Posts: 51
Smile join

For successful execution of join commd make sure the length of the
field are same on which you want to join both the file
say for exmp . if the first file is having the lenght 8 digit make sure the
second file too have 8 digit for that use %.8d hence the field will have
eight digit and if any particular record have six digit that will be read like
00123456 and like wise and you can join both the file regardless of the
numbers of records. You may give example for more details. I hope I have
made it clear .
Reply With Quote
  #5  
Old 01-27-2008
drl's Avatar
drl drl is offline
Registered User
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 556
Hi.

If you are still having trouble, then post the smallest sample -- including data, commands, and results -- that fails for you so that we can provide specific help ... cheers, drl
Reply With Quote
Google The UNIX and Linux Forums
Reply

« history | sort »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0