88020:Maria Aguiar:EIB2:914256321:[email protected]:carro:Mercedes:1414-TX-13:13:14:4
83605:Tiago Domingues:ETA4:934442913:[email protected]:carro:BMW:14-TD-16:1:130:200
I have this code in a file, named condutores.txt
.
And in the script I wanted to change the ninth column by a value that I intend for example.
And I've tried this:
Numero9=$(cat condutores.txt | awk -F ':' '{print $9}' | tail -n +$1 | head -1)
NovoNumero9=$(( $Numero9+ 1 ))
sed -i 's/'"$Numero9"'/'"$NovoNumero9"'/' condutores.txt
But it changes me all the places along the line where $Numero9
occurs and I wanted it to change only in the ninth column, the columns being divided by ":"
.