Skip to content
Advertisement

how to replace decimal in linux

I have a csv file with error in one field, the fields are separated by "," but the error is in decimal field, for example 34.25," i need replace by 34.25",".

Search ," and replace by "," is not option, others fields will modified.

Advertisement

Answer

Check that the character before ," is not a double quote, and if it’s not, add the double quote:

sed 's/([^"]),"/1","/'
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement