Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Replace Line Feed character in Nifi

Solved Go to solution

Replace Line Feed character in Nifi

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

Accepted Solutions

Re: Replace Line Feed character in Nifi

Super 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).

3 REPLIES 3

Re: Replace Line Feed character in Nifi

Super 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).

Re: Replace Line Feed character in Nifi

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

Re: Replace Line Feed character in Nifi

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

Don't have an account?
Coming from Hortonworks? Activate your account here