I have a problem with this awk command because after the first iteration of the while loop, the information is written in the same line as the first iteration instead of written in the row where the value is found.
while read list
do
awk -v M="$Variable" -v R="Fail" -v J="Sorry, but this fail" -v K="N/A" '
BEGIN {FS=","; OFS=","}
$1==M {$14=R; $21=J; $22=K; print}
$1 != M ' file.csv > file2.csv
done < list.csv
file2.csvas many times as there are lines inlist.csvbut you have not explained why it's doing this, or how the files are related. Do you just want to loop over lines infile.csv? Then thewhileloop is superfluous. Doeslist.csvcontain names of files to process? Then the loop should use the value in$listfor something, such as the input file name for Awk.