CR/LF and removing extra ones

Highlighted
One Star

CR/LF and removing extra ones

Any know the best way of removing cr/lf or just lf from a string ?
My file looks like this;
"AAAAAA","bbbbbb","CCCCCCC\r\n
CCCCCC","dddddd"

I'd like to get to;
"AAAAAA","bbbbbb","CCCCCCCCCCCCC","dddddd"
Thanks
Seven Stars

Re: CR/LF and removing extra ones

I think you need to read the file using tFileInputDelimited with CSV options and then use tJavaRow to remove the linefeeds.
If the linefeed is always in the same field, just use e.g. output_row.field3 = input_row.field3.replace("\\r\\n\r\n","");
If you don't know which field has the linefeed or it can change from row to row, you'll have to use reflection to loop through all the fields doing the replace. I've never used reflection myself, having only very basic Java knowledge but this topic (http://www.talendforge.org/forum/viewtopic.php?id=14940) should help you hopefully.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download