![]() |
|
|
|
|
|||||||
| 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 |
| combining fields in two text fields | shocker | Shell Programming and Scripting | 3 | 01-16-2008 08:27 AM |
| joining the data | vakharia Mahesh | UNIX Desktop for Dummies Questions & Answers | 0 | 03-15-2007 08:49 AM |
| Help with joining two files | rjlohman | Shell Programming and Scripting | 3 | 09-27-2006 08:55 AM |
| joining files | Manu | UNIX for Dummies Questions & Answers | 2 | 04-25-2005 09:24 AM |
| joining 2 files | webtekie | UNIX for Dummies Questions & Answers | 1 | 10-21-2003 07:51 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Joining 3 fields of a fiile
I am having two files which are pipe_delimited. I want only those rows in the output which are common values in 3 columns of both the files. The column Numbers in both the files are same as 3,29,31. Can you please suggest me a way in which i can get the required data. Thanks in advance
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
A sample of the input files and the wanted output would be helpful.
|
|
#3
|
|||
|
|||
|
man join
it might take two iterations to get what you want |
|
#4
|
|||
|
|||
|
Example
File 1 20071121|12|Mohit|DAV 20071222|13|Dev|MRSD 20071011|14|Rajan|ST File 2 12|KKP|Pun|Mohit 14|FDK|Pas|Abhi 15|SAD|Hp|Lali Now it should join based on column 2,3 of first file and 1,4 column of second file. Now can u please help me. Also suggest a way in which if column number are also same in both the files. Thanks |
|
#5
|
|||
|
|||
|
Quote:
|
|
#6
|
|||
|
|||
|
hi,
the needed result should be like this: 12|Mohit And also tell a way in which i can get the following result: 12|Mohit|20071121|DAV|KKP|Pun thanks |
|
#7
|
||||
|
||||
|
Code:
join -t\| -1 3 -2 4 -o 1.2,1.3 file1 file2 Quote:
Code:
join -t\| -1 3 -2 4 file1 file2 |
||||
| Google The UNIX and Linux Forums |