How to add text to a field within a csv file

I have a csv file which has three columns

mem no. name surname
1234 John Smith
12345 John Doe

I want to change the mem no. to add TF to the mem no. field i.e.

mem no. name surname
1234TF John Smith
12345TF John Doe

How do you do this for all records in the file?

hmmm, isn't a CSV-file comma-separated? Your file looks space-separated.

Anyway, if <space> is your field delimiter:

sed 's/ /TF&/' oldfile > newfile

If the file is comma-separated change the space in the regexp to a comma.

I hope this helps.

bakunin

Sorry it is comma seperated and that works great, however it adds the TF the header SEE BELOW

mem no.TF name surname
1234TF John Smith
12345TF John Doe

I don't want it to do this also after i have processed this file i need to remove the TF from all records, what is the best way to do this?

Thanks for your help

i have sorted the header problem by doing the following:

tail +2 infile.csv | sed 's/,/TF&/' > outfile.csv