I have a csv file in which i have to search a particular string and replace the data in any column with something else. How do i do it using awk.
file
------
2001,John,USA,MN,20101001,29091.50,M,Active,Y
2002,Mike,USA,NY,20090130,342.00,M,Pending,N
2003,Steffi,USA,MN,20070101,23222.89,F,Active,Y
Now if i want to search this file for data in column 4, i can say:
awk -F, '$4 == "MN" {print $1}' file
This would give me the first column from all rows in the file that have MN in 4th column.
But how do i replace the data in say 8th column? e.g Change it to N if 4th column has MN in it.
Thanks.