Hi All,
In below code, i am trying to read row line byb line to get the src & cod. Once i get the src & cod, i am trying to get the cnt from detail.txt file, where 1st column should match src & second column should match cod. But in both i am getting error. Could you please let me know where i have done a mistake?
cat main.txt | while read args
do
src=`echo $args | awk -F"," '{print $1}'`
cod=`echo $args | awk -F"," '{print $2}'`
cnt=`awk -F"," '{ if ($1 == "$src" && $2 == "$cod") print $3}' detail.txt`
or
cnt=`awk -F"," '$1 ~ /$src/ && $2 ~ /$cod/ {print $3}' detail.txt`
done