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
list common name files mazhar99 UNIX for Dummies Questions & Answers 4 08-18-2008 11:21 PM
Help with complex merg of files with common field gugs Shell Programming and Scripting 18 07-16-2008 05:04 AM
merge based on common, awk help jkl_jkl Shell Programming and Scripting 3 03-17-2008 07:13 AM
bash script working for small size files but not for big size files. davidpreml Shell Programming and Scripting 1 11-01-2006 11:06 AM
Get un common numbers from two files jingi1234 UNIX for Dummies Questions & Answers 3 10-19-2005 08:32 AM

Closed Thread
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
  #1 (permalink)  
Old 03-03-2009
shashi1982 shashi1982 is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 1
Merge files of differrent size with one field common in both files using awk

hi,

i am facing a problem in merging two files using awk,
the problem is as stated below,

file1:

A|B|C|D|E|F|G|H|I|1
M|N|O|P|Q|R|S|T|U|2
AA|BB|CC|DD|EE|FF|GG|HH|II|1
....
....
....

file2 :

1|Mn|op|qr



result file
A|B|C|Mn|op|qr|D|E|F|G|H|I|1
M|N|O|P|Q|R|S|T|U|2
AA|BB|CC|Mn|op|qr||DD|EE|FF|GG|HH|II|1

file1 can have more than 10,000 records
file2 can have only 1000 records,

The field's 2,3,4 from second file (file2) should be read and should be inserted into filed's 4,5,6 in first file (file1) where lastfiled of "ile1 == first field of file2"

please give me the solution.......
Thanks
  #2 (permalink)  
Old 03-03-2009
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
There are plenty of similar threads - please use the 'Search' function.
  #3 (permalink)  
Old 03-03-2009
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,294
To be more precisely, search for NR==FNR.

Regards
Closed Thread

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:40 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