The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 04:20 AM
Join two files koti_rama Shell Programming and Scripting 4 06-10-2008 06:15 AM
how to join files jxh461 UNIX for Dummies Questions & Answers 5 08-23-2007 07:11 AM
Sum of Files Sizes starting with a letter... pbsrinivas Shell Programming and Scripting 2 07-25-2007 08:21 AM
Join Files choppas Shell Programming and Scripting 2 10-18-2006 10:03 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-23-2008
annelie annelie is offline
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!
  #2 (permalink)  
Old 01-23-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
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 $?
  #3 (permalink)  
Old 01-23-2008
annelie annelie is offline
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!
  #4 (permalink)  
Old 01-27-2008
vakharia Mahesh vakharia Mahesh is offline
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 .
  #5 (permalink)  
Old 01-27-2008
drl's Avatar
drl drl is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 704
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
Closed Thread

Bookmarks

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

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




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


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0