I am having a file whose contents are as follows:A,10,20,30,40,50B,20,40,10,30,60C,30,50,20,40,10D,40,50,20,10,30I wish to perform some arithmetic operation (say Division by 10) on a particular column (say Column 3) of above CSV file. So that, it reads :A,10,2,30,40,50B,20,4,10,30,60C,30,5,20,40,10D,40,5,20,10,30How can this be done?
Arithmetic operations on a particular column of a CSV file in Bash
bash;bash script
Try this:% awk -F , -v OFS=, '$3/=10' <fileA,10,2,30,40,50B,20,4,10,30,60C,30,5,20,40,10D,40,5,20,10,30