Reading from a CSV and writing in same CSV file

Hi,

I am tryng to read from a csv file and based on some grep command output I will modify one of the column in the same csv.

Example:-

Input CSV:-

20120829001415,noneAA,google.com
20120829001415,dfsafds,google.com
20120829001415,noneAA,google.com

Intermediate Step:- If 2nd column of input csv is noneAA then I have to run a grep and and store the result of the grep command and then update the 2nd column with the stored value received from the grep.

Output CSV:-

20120829001415,abcd,google.com
20120829001415,dfsafds,google.com
20120829001415,dfgd,google.com

Thanks in advance.

you have to be more descriptive than that.
What does "based on some grep command output" mean?
How did you arrive at your desired output sample from the sample input?

Yes. I have figured out that. I just need to know how I modify the same CSV file while reading it.

it all depends on the 'tools' you're using to modify a file.
the easiest/generic paradigm is to write to a temp file, and rename a temp file to the original CSV file AFTER the original file is fully read/processed.