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
Highlighted
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 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog