Lookup between 2 files ( korn shell )
- From: "pawan_test" <sridhara007@xxxxxxxxx>
- Date: 27 Jan 2006 15:48:41 -0800
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 ..( Korn shell)
tx
pavi
.
- Follow-Ups:
- Re: Lookup between 2 files ( korn shell )
- From: romy
- Re: Lookup between 2 files ( korn shell )
- From: Barry Margolin
- Re: Lookup between 2 files ( korn shell )
- Prev by Date: Variation of "diff -qr" to compare file sizes/dates between file tree?
- Next by Date: Re: Variation of "diff -qr" to compare file sizes/dates between file tree?
- Previous by thread: Variation of "diff -qr" to compare file sizes/dates between file tree?
- Next by thread: Re: Lookup between 2 files ( korn shell )
- Index(es):
Relevant Pages
|