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
Lookup on a file ukatru Shell Programming and Scripting 4 07-31-2008 02:25 AM
Lookup on a file ukatru UNIX for Advanced & Expert Users 1 07-29-2008 12:33 PM
file Lookup using awk jerome Sukumar Shell Programming and Scripting 1 08-30-2007 04:28 AM
Lookup with a file pavan_test UNIX for Dummies Questions & Answers 5 07-21-2006 11:57 AM
file lookup gillbates UNIX for Dummies Questions & Answers 6 12-12-2003 02:04 PM

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 08-05-2008
mohan705 mohan705 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
Lookup file

I have two files ,File1 lookup to file2 based on 1st&3rd against 1st and 2nd column and produce the following o/p

File1

450000|USD|USD
450006|GKSGD|SGD
450002|XSGD|SGD

File2
-----

450000|USD|2000.00|10000.000
450006|SGD|1000.200|3000.000
450002|SGD|3000.000|20000.00


O/p

450000|SGD|2000.00|10000.000
450006|SGD|1000.200|3000.000
450002|SGD|3000.000|20000.00

Thanks,
MR
  #2 (permalink)  
Old 08-05-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
It's not clear what the relationship is between File1 and File2. The requested output seems to differ from File2 only in that the first line has SGD instead of USD, which doesn't particularly match anything specific in File1. Perhaps you can explain how they are related, and how to produce the requested output?

Anyway, search this site for NR==FNR for a lot of similar problems, with solutions.

Last edited by era; 08-05-2008 at 04:07 AM..
  #3 (permalink)  
Old 08-05-2008
mohan705 mohan705 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
Hi
Relationship is 1st and 3rd column from file1 check against 1st and 2 column from file 2 if matches ,return it

ex: 450000&USD(1st and 3rd) from file 1 check against 450000&USD(1st and 2nd)

Thanks
MR
  #4 (permalink)  
Old 08-05-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
So why does the sample output have SGD? Maybe you can come up with a better example.

Anyway, this is a FAQ; try the search I posted.
  #5 (permalink)  
Old 08-05-2008
mohan705 mohan705 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 134
Hi Era,

Sorry for mistake.Thanks its really helped a lot

Thanks
MR
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 11:49 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