replace lf with space but not cr

Highlighted
Five Stars

replace lf with space but not cr

Is there any way in Talend to replace a lf (linefeed) character with a space but not affect cr (Carriage return)?
I've tried to modify the input field in my tmap with replacing \n with a space with no change. I've also tried the tReplace searching for \n to replace with a string with no change.

the input text would be something like with | as a separator
field1 | field2| field3 some textLF
more textLF
more text|field4 | field5 CR


which I would like to see in the format of
field1 | field2| field3 some text more text more text|field4 | field5 CR


Accepted Solutions
Highlighted
Sixteen Stars
Sixteen Stars

Re: replace lf with space but not cr

Use tFileInputFullRow to read the input file with \r for the row separator and line.replaceAll("\\n", " ") to replace \n all by spaces.
It should work (maybe \n istead of \\n).

TRF

View solution in original post


All Replies
Highlighted
Sixteen Stars
Sixteen Stars

Re: replace lf with space but not cr

Use tFileInputFullRow to read the input file with \r for the row separator and line.replaceAll("\\n", " ") to replace \n all by spaces.
It should work (maybe \n istead of \\n).

TRF

View solution in original post

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

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now