How to remove a specific pattern from the flow file through replace text in nifi by using regex

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to remove a specific pattern from the flow file through replace text in nifi by using regex

Puspak
Hi i am relatively new to nifi and expression language .Please help

Sample flow file :

=HEADER
RCV,2019/02/27 08:34
=PRIORITY
QK
270834
=SMI
FFD
=TEXT
FFD/8
1/BY0077/27FEB1045/CMB/GB/27FEB1200/LGW
ULD/PMC74349R7
612-56018325CMBLHR/T130K1172.50MC10.08/CONSOL
/DHC
LAST

The desired flow file after replacement is :
FFD/8
1/BY0077/27FEB1045/CMB/GB/27FEB1200/LGW
ULD/PMC74349R7
612-56018325CMBLHR/T130K1172.50MC10.08/CONSOL
/DHC
LAST

basically i just want to trim-out the below portion from the flow file.

=HEADER
RCV,2019/02/27 08:34
=PRIORITY
QK
270834
=SMI
FFD
=TEXT



--
Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: How to remove a specific pattern from the flow file through replace text in nifi by using regex

Peter Turcsanyi
Hi,

You can use ReplaceText with the following config:
Search Value: (?s)(^.*=TEXT)
Replacement Value: [Empty string]

Best,
Peter

On Thu, Mar 21, 2019 at 11:54 AM Puspak <[hidden email]> wrote:

> Hi i am relatively new to nifi and expression language .Please help
>
> Sample flow file :
>
> =HEADER
> RCV,2019/02/27 08:34
> =PRIORITY
> QK
> 270834
> =SMI
> FFD
> =TEXT
> FFD/8
> 1/BY0077/27FEB1045/CMB/GB/27FEB1200/LGW
> ULD/PMC74349R7
> 612-56018325CMBLHR/T130K1172.50MC10.08/CONSOL
> /DHC
> LAST
>
> The desired flow file after replacement is :
> FFD/8
> 1/BY0077/27FEB1045/CMB/GB/27FEB1200/LGW
> ULD/PMC74349R7
> 612-56018325CMBLHR/T130K1172.50MC10.08/CONSOL
> /DHC
> LAST
>
> basically i just want to trim-out the below portion from the flow file.
>
> =HEADER
> RCV,2019/02/27 08:34
> =PRIORITY
> QK
> 270834
> =SMI
> FFD
> =TEXT
>
>
>
> --
> Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/
>
Reply | Threaded
Open this post in threaded view
|

Re: How to remove a specific pattern from the flow file through replace text in nifi by using regex

Puspak
many thanks Peter,it solution works fine



--
Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/