Support Questions
Find answers, ask questions, and share your expertise

Split one Nifi flow file into Multiple flow files when a line starts with matching string

New Contributor

Hi I have a flow file like:

0000DPRODXYZ
0100 608695
0110
0150PAUL TEST DOYON
01750175MM01
032020190115Vous avez
0340SLI10086
0900|MIM-INV_624072
0100 624403
0110
0150PAUL TEST DOYON
01750175MM01
032020190115Vous avez
0340SLI10086
0900|MIM-INV_624072
999900020024

In the above record, we see there a few lines starting with 0100.
My requirement is, I want to split the above flow file into multiple files if the starting number is 0100 until it encounters next 0100.
My first flow files should look like below:
0100 608695
0110
0150PAUL TEST DOYON
01750175MM01
032020190115Vous avez
0340SLI10086
0900|MIM-INV_624072

 

2nd flowfile 

0100 624403
0110
0150PAUL TEST DOYON
01750175MM01
032020190115Vous avez
0340SLI10086
0900|MIM-INV_624072

I read about using "tokenize" in previous post. Gave it a try but couldn't get desired output.
Any help in splitting the files using ExecuteScript in NiFi would be really appreciated.

We usually have 1/2 million records to split semi-annual, also looking for advise if using a script works better or using combination of processors like Split content/ExtractText etc.

Many thanks

0 REPLIES 0