Removing consecutive double quotes

Hi I have a .csv file and when opened in notepad looks like this

gggg,nnnn,"last,first","llll""",nnn

So, Here I would like the ouput as below

gggg,nnnn,"last,first","llll",nnn

i.e replace all two double quotes into one. How could I do that?

This file is being processed by another application, so i would need the file format like this..

Thanks!!

 echo 'gggg,nnnn,"last,first","llll""",nnn' | sed 's#""*#"#g'
1 Like
perl -pe 's/"{2,}/"/g' dnat.csv
1 Like

Thanks!! both of them worked!!

You can try

tr -s '"' infile

Will you ever have a blank field in your csv file? eg:

gggg,nnnn,"last,first","",nnn
2 Likes