- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to replace/add some text for a matching patter in Nifi
- Labels:
-
Apache NiFi
Created on ‎07-21-2023 03:37 AM - edited ‎07-21-2023 03:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created ‎09-16-2023 01:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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...
Created on ‎09-18-2023 01:11 PM - edited ‎09-18-2023 01:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Forgot the ";" in the replacement value
$1($2='$3');
