I have the following code:
#!/bin/bash
exec 3< lista.csv
read -u 3 header
declare -i id_nou
echo "ID: "
read id_nou
while IFS=, && read -u 3 -r id nume prenume seria grupa nota
do
if [ "$id_nou" -eq "$id" ]
then
echo "Nota noua: "
read nota_noua
nota="inlocuit"
sed -i "s/$nota/$nota_noua/6" "$lista.csv"
fi
done
My .csv file looks something like this:
id,nume,prenume,grupa,seria,nota
1,Dan,Alexandru,1001,A,7
2,Boerescu,Andrei,1003,A,3
3,Pocoae,Mihai,1004,A,9
What I am trying to achieve is simply replace the nota variable from a specific ID with a value inputed by the keyboard. From using sed I get the following error:
".csv": invalid command code
Any advice?