I have a CSV file composed of several fields split by commas.
id,name,nationality,sex,date_of_birth,height,weight,sport,gold,silver,bronze,info
736041664,A Jesus Garcia,ESP,male,1969-10-17,1.72,64,athletics,0,0,0,
I have to change from lowercases to uppercases the values on column "name" when the column "sport" is shooting or judo. I can only use sed
. I am using this command
sed 's/\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\)/\1,\U\2\E,\3,\4,\5,\6,\7,\shooting|judo,\9,\10,\11,\12/' athletesv2.csv
But it is not working, as it's just showing "shooting|judo" in all the rows.
How can I make these replacements?
Note that the output must be a .sed file, which has to be called using sed -f script.sed athletes.csv
In the output I need to keep the header.
I am using Ubuntu Linux.