Remove CRLF from the text file

What should I add to this to remove CR and LF while generating a text file using File Writer .


@groverarena Not sure how did you get CR and LF here. You can use ‘Test/Hello_’{format: “MMMYYYY”}).toUpperCase()+’.txt’ to minimize your query.

@Supratim, I didn’t understand your response. I am talking about removing Carriage Return and Line Feeds from the text file. The above query is working fine

Ok. Then try this-
$content.replaceAll(’\r\n’, ‘’)

Where do I add this in my pipeline?

Add mapper after csv formatter , change view of mapper from document to binary for both input and output view, in then use $content.replaceAll(’\r\n’, ‘’) syntax .Make target filed as $content, it will work.

Here is the error after ,making the changes you’ve suggested.

Don’t know whether you tried what happens if mapper is before formatter, if so what is the outcome?

@groverarena Ok, before mapper use binary to document and make encoding none. Then use the suggested syntax.Make sure input view of the mapper should be document and the content type should suggest as String then it should work.

@groverarena, I didn’t understand your question entirely.

Are you trying to remove all \r\n from the CSV Formatter output (which is the row delimiter and would bring all the rows into a single row for the file), or are you trying to remove all \r\n from only field data coming from the SQL output (while keeping row delimiters in place for a valid CSV file)?

If it is the latter case, you can add a mapper between the SQL Execute and CSV Formatter with the following configuration. This will check all the values coming out of SQL Execute, and replace \r\n with an empty string.