i have 2 files, a.txt and b.txt, delimited with character |
i want to combine 2 files and the result like file output.txt
if there's missing field ini file b.txt, than the result is 'ERR'
please help me, how shell script for this case
thank you
file a.txt :
aaaa | 0001
bbbb | 0004
cccc | 0001
dddd | 0003
eeee | 0003
ffff | 0005
gggg | 0002
hhhh | 0002
iiii | 0006
jjjj | 0001
kkkk | 0001
llll | 0004
mmmm | 0005
nnnn | 0005
file b.txt :
0001 | red
0002 | yellow
0003 | blue
0004 | black
0005 | green
output :
aaaa | red
bbbb | black
cccc | red
dddd | blue
eeee | blue
ffff | green
gggg | yellow
hhhh | yellow
iiii | ERR
jjjj | red
kkkk | red
llll | black
mmmm | green
nnnn | green