Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to remove the blank lines in Nifi

avatar
Explorer

I'm currently trying to remove the blank line after discarding the lines in Nifi

Removing those lines in Nifi {"eventType":"delete","ServerSerial":"0","ServerName":"","deletedat":"2018-08-24 17:56:34.944"} Since the serial number is 0 and empty servername . After removing there will be a blank space created in the final output file I want to replace the blanks space

"eventType":"delete","ServerSerial":"1556562030","ServerName":"XYZ_U_O","deletedat":"2018-08-24 17:56:39.974"}
{"eventType":"delete","ServerSerial":"0","ServerName":"","deletedat":"2018-08-24 17:56:34.944"}

{"eventType":"delete","ServerSerial":"0","ServerName":"","deletedat":"2018-08-24 17:56:34.944"}

So I'm currently using ReplaceText to search for the value :

{"eventType":"delete","ServerSerial":"0","ServerName":""[^}]+},? 

and replacing with empty spaces . It failed to remove the blank lines

Replaced with ^[ \t]*$\r?\n --> Failed to remove .

Replaced with \r\n --> Failed to remove .

Replace value is not considered the regex value . What shall I do . How can i replace blank lines after removing the lines based on the Search value.

1 REPLY 1

avatar
Super Guru
@Raj ji

Check out this solution here:

https://community.hortonworks.com/questions/147226/replacetextprocessor-remove-blank-lines.html

If this answer is helpful please choose ACCEPT to mark the question resolved.