Lookup between 2 files ( korn shell )
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > Lookup between 2 files ( korn shell )




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Lookup between 2 files ( korn shell )  
pawan_test


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-30-06 02:32 AM

Hello

Thanks guys for your suggestions;

FILE1=/home/pavi/DS.txt
FILE2=/home/pavi/chain.txt

awk -F ":" '{print $1}' $FILE1 > f1.txt
awk -F " " '{print $2}' $FILE2 > f2.txt


DS.txt contains;

ALBD:xxxxx
FLN:yyyyyyy
WLG:ttttttt

chain.txt contain;

ECK: ECK: 331
ECK: ECK: 336
FED :FED :427
FIE :FIE: 212
FLN :FLN: 140
FLN :FLN :141
FMF: FMF: 183
FR1 :FR1: 303
FTT :FTT :423
GAT :GAT: 185
GEN :GEN: 396
GFY :GFY: 268
GIA :GIA: 228
GMD :GMD: 264
MIN: MIN: 158
MRO :MRO: 354
MY0 :MY0: 315
NCS :NCS: 390
OSC :ALBD: 377
OSC :ALBD :378
OSC: ALBD: 379
OSC ALBD 380
WLG :WLG :243
WLG: WLG: 244
WLG :WLG: 245
WLG :WLG :246
MAT: WLG :247

the result.txt has to look like this;


OSC :ALBD: 377
OSC :ALBD :378
OSC: ALBD: 379
FLN :FLN: 140
FLN :FLN :141
WLG :WLG :243
WLG: WLG: 244
WLG :WLG: 245
WLG :WLG :246
MAT: WLG :247

the script has to match the 1st column from DS.txt with the 2nd column
of chain.txt and only those that matched, move all the corresponding
1st , 2nd and 3rd columns of chain.txt to a output file say result.txt

this is what i am trying to accomplish.

can anyone please help me ..

tx
pavi






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:21 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register