lundi 5 janvier 2015

How can I replace string in a file?


I have the following line in a file, I would like to insert \N between two comma



20121128020001,2012-11-28 02:00:01.000,,,,,,,3.80,,,,,


I tried to use seed



sed -i 's/,,/,\\N,/g' Test.CSV


Where I get the following result:



0121128020001,2012-11-28 02:00:01.000,\N,,\N,,\N,,3.80,\N,,\N,,


I could run two times, but in a huge file it is inefficient. How can I fix the sed command?



Aucun commentaire:

Enregistrer un commentaire