• Creator
  • #3974736

    Change values from a dataset variable in Bash

    by agar.values.0z ·


    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.

You are posting a reply to: Change values from a dataset variable in Bash

The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our Community FAQs for details. All submitted content is subject to our Terms of Use.

All Answers

Viewing 0 reply threads