I apologize in advance if this seems like a simple question. However, I am a beginner in bash commands and scripting, so I hope you all understand why I am not able to solve this on my own.
What I want to achieve is to change the values in one field of a csv file to uppercase, and then resave the csv file with the transformed field and all the other fields included, each retaining their index.
For instance, I have this csv:
1,Jun 4 2021,car,4856
2,Jul 31 2021,car,4154
3,Aug 14 2021,bus,4070
4,Aug 2 2021,car,4095
I want to transform the third field that holds the vehicle type into uppercase - CAR, BUS, etc. and then resave the csv file with the transformed field.
I have tried using the 'tr' command thus:
cut -d"," -f4 data.csv | tr '[:lower:]' '[:upper:]'
This takes the field and does the transformation. But how do I paste and replace the column in the csv file? It did not work because the field argument cannot be passed into the tr command.