All,
I have a small program which reads 2 text files. Text files has the below layout
dictionary
C_BOX LB_BOX
C_CHAIR LB_CHAIR
C_HAT LB_HAT
lookup
C_HAT
C_BOX
C_CHAIR
The program is below
#!/bin/bash
DICT=$2
exec < $1
while read f1
do
nawk -v fld=${f1} '/$1=fld/ { print fld $2}' $DICT
done
What I am trying is achieve is to generate a third file which will have the output.
file 3
C_HAT LB_HAT
C_BOX LB_BOX
C_CHAIR LB_CHAIR
I want to get the corresponding name and value for the "file1" fields from "dictionary". The sequence of occurence should also be maintained as it is in "file1"