Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Lookup subfields from 3 tables and insert

$
0
0
Hello masters,

Please help on the following.
I have a tab delimited file with subfields space delimited.

Code:

1        a b        x y        hhghd ghgf
2        v t        f g        gdgdgdg hghg

I have 3 lookup table files tab delimited, for fields 2,3 and 4 respectively

Code:


Lookup2

a        10
b        20
v        30
t        40

Lookup3

x        50
y        60
f        70
g        80

Lookup4

hhghd        90
ghgf        100
gdgdgdg        110
hghg        120

I want to find the lookup values for cols 2,3 and 4 from the corresponding files and then insert a column next to the looked up subfield value, in the same space delimited format.

Code:

1        a b        10 20        x y        50 60        hhghd ghgf        90 100
2        v t        30 40        f g        70 80        gdgdgdg hghg        110 120

Please note that this is a simplified example, in the original file the columns to be looked up are not next to each other. The are $2, $74 and $126 if that information matters.

Viewing all articles
Browse latest Browse all 16232

Trending Articles