![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
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. |
|||
| Google The UNIX and Linux Forums |