Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
SCook
Contributor
Contributor

Removing \, (backslash comma) in incoming CSV file

I am receiving a CSV file that has an escaped comma.  I need to remove the \, from the file because otherwise the comma causes an offset and adds extra columns.  I have tried using CSV options and various functions in tMap but haven't been able to accomplish this.  I am using Talend Studio v8.

For example, I need to remove the \, after Drug so that it is just Drug Fentanyl or Drug-Fentanyl (if I replace space with dash).  The data is not encased in double quotes and looks exactly like below.  It comes in from the original source as 'Drug, Fentanyl' and a 3rd party is escaping the comma.

Item1234,Drug\, Fentanyl .05mg/ml

Labels (2)
1 Reply
Shicong_Hong
Employee
Employee

Hi 

You can read the entire file as a string ,and replace "\," with "", then generate a new csv file or extract fields using tExtractDelimitedFields. eg:

tFileInputRaw--main--tJavaRow--tFileOutputRaw

on tJavaRow:

output_row.content = input_row.content.toString().replaceAll("\\\\,","");

 

Regards

Shicong