Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

How to replace/add some text for a matching patter in Nifi

avatar
Contributor

Hi,

 

Is there any processor to add some text/characters to each line in the flowfile in Nifi. Replace text seems to be more complicated given that the partiton value keeps changing.

 

compute incremental stats mydb.mytable partition (date=2023-07-21);

compute incremental stats mydb.mytable partition (name=abc);

to

compute incremental stats mydb.mytable partition (date='2023-07-21');

compute incremental stats mydb.mytable partition (name='abc');

 

Note: date=2023-07-21 comes as a complete string from the sys.partitions.part_name table in hive. We will need to add '' to the date.

2 REPLIES 2

avatar
Super Collaborator

ReplaceText processor should work..

This RegEx search pattern should do the trick:

^(.*?)\(([^=]*)=([^\)]*)\);$

With this replacement value:

$1($2='$3')

Don't forget to set the evaluation mode to line-by-line...

avatar
Super Collaborator

Forgot the ";" in the replacement value

 

$1($2='$3');