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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Matching and combining two files p3t3r Shell Programming and Scripting 5 05-20-2008 11:16 AM
Combining two files hemangjani Shell Programming and Scripting 7 06-13-2007 11:32 PM
Combining Two Files stevefox Shell Programming and Scripting 4 02-20-2006 05:09 AM
Combining files Enda Martin UNIX for Dummies Questions & Answers 2 07-20-2001 11:31 AM
combining files apalex UNIX for Dummies Questions & Answers 3 06-19-2001 10:49 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-17-2008
sickboy sickboy is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 62
Matching and combining two files

Hi there,

I have two files. What I want to do is search for the values in second field of file1 in the 6th field of the file2 and of they match to add the fields 1-5 of the file2 at the end of the line of file1 with a comma before.

E.g

Code:
File1
FWB,CHUAGT87HUMAS/BUD01,REUAIR08KLM
FWB,CHUAGT87HUMAS/BUD01,REUAIR08MPH
FHL,CHUAGT87HUMAS/BUD03,REUAIR08KLM
FHL,CHUAGT87HUMAS/BUD03,REUAIR08AFR
FSR,CHUAGT87HUMAS/BUD03,REUAIR08KLM


Code:
File2
HU,ARTUKJK HLDHLL,Budapest,0,NIL,CHUAGT87HUMAS/BUD01
ZA,HHHJKJH,Cape Town,7747046,2005,REUAGT82BURL/CPT01
ZA,JHKKB BKJB,Cape Town,7747046,8003,REUAGT87BAX/CPT01
GB,HMBKLJBHJO,Cardiff,9147007,204,REUAGT87BAX/CWL01
GB,UJHJKHJK,Cardiff,9147069,205,REUAGT82SHNK/CWL01
US,UIGHIKUHKJHJ,Charlotte,110608,452,REUAGT87BAX/CLT01

So the entry in the new file will look

Code:
Newfile
FWB,CHUAGT87HUMAS/BUD01,REUAIR08KLM,HU,ARTUKJK HLDHLL,Budapest,0,NIL

Thanks in advance!
 

Bookmarks

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 08:04 AM.


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