I have a file like a database where I save name,surname,date of birth, gift, and I want to know if this person have got a gift from us or not. Those dates are splited by tabs in the file, one person per line, like:
name1 surname1 dateofbirth1 gift1
name2 surname2 dateofbirth2 gift2
Inside gift colum, I save "Yes" or "No" and my code looks like:
while IFS=$'\t' read -r name surname dob gift; do
if [[ "$gift" == "No" ]]; then
echo "Congrats, here is your gift
gift=Yes
fi
done < "file.txt"
But the gift colum, don't seems to change to yes, only seems to be there as an aux var. How can I change the value of that line, in that colum, to yes?