Change values from a dataset variable in Bash
I am new in Bash and I am trying to change the values of a column from the file data.csv coma delimitted.
In the dataset I have the variable sex with only 2 possible values ‘Female’ and ‘Male’ and I would like to transform Male into ‘m’ and Female into ‘f’. I have tried this:
sex=$(cut -d , -f 5 data.csv) #I select column 5 related with the variable sex
for i in $sex; do
if [[$i=’Female’]]; then
The code is wrong and I do not know how to modify it.
Besides, I would like to update my data.csv with the new values in sex.