How to parse a csv file which has some field containing seprator (comma) as-values

sample message - 111,222,333,444,555,val1in6th,val2in6th,777
The sixth column contains a value consisting of commas (val1in6th,val2in6th is a sample value of 6th column).
When I use a simple csv filter this message is getting converted to 8 fields. I want to be able to tell the filter that val1in6th,val2in6th should be treated as a single value and placed as the value of 6th column (its okay not to have comma between val1in6th and val2in6th when placed as the output as 6th column).

Hi there,

are all the other fields always numeric and the 6th field always alphanumeric?

No, all fields are string. This is just an example. I can't paste the original values here because of company restrictions.

If you want to have a comma in a field of a CSV then the entire field has to be in double quotes.

1 Like

Exactly. One way or another, I guess your best shot is to edit your document upstream (you either choose a different type of separator or you replace the commas in that field with another symbol or you surround that field with double quotes as Badger suggested).

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.