I have a requirement where I need to append values to a global string and add a new line character after each line.
iput data looks like below
a,b
1,2
3,4
5,6
str_val=""
for file in $input_dir*;do
echo $file
while IFS=, read -r col1 col2
do
str_val+="${col1}_${col2}\n"
done < $file
done
echo $str_val
above is what I came up with so far and it is printing only the last value \n3_4
can anyone tell me where am I doing wrong?