Hi, iam new to unix scripting need a help.
The scenario is i have 2 text files.
a.txt has
PHP Code:
colA colB colC colD
JKU1270A JKU1042A 9 1
JKU1270A JKU1042B 9 1
JKU1270A JKU1042C 9 1
JKU1270B JKU1107B 9 1
JKU1270B JKU1107C 9 1
JKU1270B JKU1090A 9 1
JKU1270X JKU1042X 9 1
JKU1270X JKU1042Y 9 1
JKU1270X JKU1042Z 9 1
JKU1270X JKU1122X 9 1
b.txt has
PHP Code:
colA colB colC colD
TOY6055A JK20CR0R05 60551 4379
TOY6055B JK20CR0R05 60552 4379
TOY6055C JK20CR0R05 60553 4379
JKU1270A JK20CR0R05 51 4412
JKU0005B JK20CR0R05 52 4412
JKU0005C JK20CR0R06 53 4412
JKU0005X JK20CR0R07 57 9884
JKU1270B JK20CR0R08 58 9884
JKU0005Z JK20CR0R05 59 9884
JKU0019A JK20CR0R05 191 4412
JKU1270X JK20CR0R04 192 4412
JKU0019C JK20CR0R05 193 4412
JKU0019T JK20CR0R05 194 587
JKU0019U JK20CR0R05 195 587
JKU0019V JK20CR0R05 196 587
JKU0019X JK20CR0R05 197 9884
JKU0019Y JK20CR0R05 198 9884
JKU1042A JK20CR0R06 199 687
JKU1042B JK20CR0R07 200 612
JKU1042C JK20CR0R08 201 9720
JKU1107B JK20CR0R09 202 9884
JKU1107C JK20CR0R10 203 4412
JKU1090A JK20CR0R11 204 612
JKU1042X JK20CR0R12 205 687
JKU1042Y JK20CR0R13 206 612
JKU1042Z JK20CR0R14 207 4379
JKU1122X JK20CR0R15 208 4379
the output file should be having all columns in a.txt with lookup values of column A, B appended next to it. b.txt has unique values in colA , where as a.txt may have duplicates in colA,colb.
The returning lookup from b.txt is the colD.
The output file should be like this.
PHP Code:
colA colB colC colD colE(lookup colA) colF(lookup colB) colG(check colE=colF)
JKU1270A JKU1042A 9 1 4412 687 no
JKU1270A JKU1042B 9 1 4412 612 no
JKU1270A JKU1042C 9 1 4412 9720 no
JKU1270B JKU1107B 9 1 9884 9884 yes
JKU1270B JKU1107C 9 1 9884 4412 no
JKU1270B JKU1090A 9 1 9884 612 no
JKU1270X JKU1042X 9 1 4412 687 no
JKU1270X JKU1042Y 9 1 4412 612 no
JKU1270X JKU1042Z 9 1 4412 4379 no
JKU1270X JKU1122X 9 1 4412 4379 no
Thanks in advance.
Moderator's Comments:
|
|
edit by bakunin: how exactly is this "advanced and expert"? You said it yourself: "iam new to unix scripting". Transferring the thread to the "shell programming and scripting" board.
|
|