Trying to echo line variable along with another variable inside a while read loop

23 Views Asked by At

Am trying to echo a line variable along with another variable like below

while read -r line;do
id1=$(echo "$line"|grep...)
id2=`grep "$id1"...."
echo "$line" , "${id2}" >> file2.csv
done <$file1.csv

Expected output - line,id2

But the output in reality is like: line

,id2line

What am I doing wrong here

0

There are 0 best solutions below