Removing commas from CSV file

Hi
I'm creating a sh script to generate a csv file. The CSV contains the values from a sql table.
The content looks this:

 a,b,c,c2,c3,,,,,,,,,,,d,e

I have some code that can separate the fields using the comma as delimiter, but some values actually contain commas, such as c,c2,c3,,,,,,,,,

This field needs to be taken as one field and the trailing commas after c3 must be removed.
Can anybody please help in doing this ?

Thanks in advance!!

there was a similar discussion recently.

1 Like

Since you are creating the file, why not use a different delimiter than the comma? Semi-colon, pipe, tilde are all delimiters I have used to separate fields. Then just alter the other program to know the different delimiter.

1 Like