Reputation: 603
I need to remove the unicode char NEL from my flowfiles in NIFI dataflow Until now i have used replacetext processor to cleanse data, but how do i search for a unicode string from within replacetext processor
Upvotes: 2
Views: 831
Reputation: 28564
1/ I just copy-paste that symbol into search string.
2/ use expression: ${literal('…'):unescapeXml()}
3/ you can replace char with script (groovy)
def ff = session.get()
if(!ff)return
ff = session.write(ff, {rawIn, rawOut->
rawIn.withReader("UTF-8"){reader->
rawOut.withWriter("UTF-8"){writer->
reader.transformChar(writer){ch-> ch==(char)'\u0085' ? '' : ch }
}
}
} as StreamCallback)
session.transfer(ff, REL_SUCCESS)
Upvotes: 4