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
Compare 2 files through multiple fields newinawk Shell Programming and Scripting 4 06-12-2008 01:34 PM
combining fields in two text fields shocker Shell Programming and Scripting 3 01-16-2008 08:27 AM
Command line tool to join multiple .wmv files? karman OS X (Apple) 2 09-22-2007 10:52 PM
Awk Join multiple lines hitmansilentass Shell Programming and Scripting 5 10-27-2006 08:04 AM
awk print fields to multiple files? TheCrunge Shell Programming and Scripting 1 06-08-2006 04:05 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-09-2005
Registered User
 

Join Date: May 2005
Posts: 27
join on multiple fields

Is it possible to do a join on multiple fields of two files? I am trying to do something like join -t, -1 2,3 -2 2,3 -o 2.1,2.2,2.3,1.3 filea fileb
I want the join to be on columns 2 and 3 of filea and columns 2 and 3 of fileb.
What is hapenning is that the second file that I want to do the join on is being ignored.
Reply With Quote
Forum Sponsor
  #2  
Old 05-10-2005
Registered User
 

Join Date: Feb 2005
Location: Coimbatore, Tamilnadu, India
Posts: 119
You can use awk as,

awk '{ getline fa < "filea"; split(fa,a," "); print a[2]a[3]$2$3 }' fileb

It will cat 2,3 fileds of filea and 2&3 of fileb.

HTH.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:13 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