I have a csv
file and I need to replace all the commas with dots. In other words, I need only the semicolon as a separator, and the commas need to be replaced with dots.
I need this in order to import the data with mongoimport
.
I used the sed command, but it does not replace every occurrency of comma. For example:
Zolmitriptan;6 UNITA' 2,5 MG - USO ORALE;N02CC03;33345149;ZOMIG RAPIMELT;"""2,5 MG COMPRESSE ORODISPERSIBILI"" 6 COMPRESSE IN BLISTER";ASTRAZENECA S.P.A.;17,84;20,84;;3,00;FUB
becomes this , with sed 's/\,/\./' <filename>
:
Zolmitriptan;6 UNITA' 2.5 MG - USO ORALE;N02CC03;33345149;ZOMIG RAPIMELT;"""2,5 MG COMPRESSE ORODISPERSIBILI"" 6 COMPRESSE IN BLISTER";ASTRAZENECA S.P.A.;17,84;20,84;;3,00;FUB
Notice that only the first comma was replaced. What am I doing wrong?
PS. Is there a way to make mongoimport ignore the commas? (in this case I would not need the replacement)
I was not using the global option, so
sed 's/\,/\./g'
is now working. The question remains open for the mongoimport alternative, though!