There are multiple lines in my input file (SerialNos.csv
), like this:
4TF16B7GA129E
4TF16B7GA129S
4TF16B7GA129D
4TF16B7GA129X
I want to read each line, compute a checksum,
and write the result to another file,
but my output file Token.csv
only has one output line.
How can I process every line?
My Code:
epoch=$(date -d "`date`" +"%s")
StringCsv="/home/Desktop/TokenGenScript/SerialNos.csv"
StringToken=b5242a2d7973c1aca3723c834ba0d239
while IFS=$'\n' read -r line || [ -n "$line" ]
do
j=$line
serial=${j}:${epoch}:${StringToken}
echo "$serial"|sha256sum > Token.csv
done < "$StringCsv"
date
.