Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Replace Line Feed character in Nifi

avatar

I have a line feed LF character in my csv file that I would like to replace with a pipe character |. ASCII value for LF is 10

How can i do that using replace text processor.

1 ACCEPTED SOLUTION

avatar
Master Guru

You should be able to use line-by-line as the Evaluation Mode in the ReplaceText processor, using \n or \\n (the slash may need to be escaped, e.g.) as the match value and | or \| as the replace value (again, the latter if it needs to be escaped to be proper regex for the pipe character).

View solution in original post

3 REPLIES 3

avatar
Master Guru

You should be able to use line-by-line as the Evaluation Mode in the ReplaceText processor, using \n or \\n (the slash may need to be escaped, e.g.) as the match value and | or \| as the replace value (again, the latter if it needs to be escaped to be proper regex for the pipe character).

avatar

Thanks Matt. that worked. I was curious why it does not work with the "Entire Text" evaluation mode.

avatar

Hi @Matt Burgess

I want to do something like this ${'$1':escapeJson()} as replacement value in replaceText processor
search value being (?s)(^.*$)
evaluation mode line-by-line

bt this is not working as expected.
can you please help if i need to replace each line of file with jsonescaped content