Created 02-02-2018 09:28 PM
Hello, guys,
I'm trying to use Nifi to split a text file into 2 other files. I just have a problem with that: I need to split them based on their category type.
e.g.
FlowFile content:
Some fixed text |1| more text
Another field |8| more text
Last one |1| more text
With that, I'd like to split this file into, for example:
first FlowFile:
Some fixed text |1| more text
Last one |1| more text
second FlowFile:
Another field |8| more text
Do you guys have any idea on how to accomplish that using Nifi? I appreciate any help you can provide.
Thanks in advance,
Cheers!
Created on 02-02-2018 09:54 PM - edited 08-17-2019 10:47 PM
Use RouteText Processor (The data is then routed according to these rules, routing each line of the text individually) and then configure the processor as
Route text Configs:-
Routing Strategy
Route to each matching Property Name
Matching Strategy
Contains
Ignore Leading/Trailing Whitespace
true
Ignore Case
true
Grouping Regular Expression No value set flowfile1
|1| more text //checks the line having the content and routes to flowfile1 relation
flowfile2
|8| more text //checks the line having the content and routes to flowfile1 relation
Input:-
Some fixed text |1| more text Another field |8| more text Last one |1| more text
Output:-
Flowfile1:-
as we are checking if the contents having |1| more text so the following lines will routes to flowfile1 relationship
Some fixed text |1| more text Last one |1| more text
Flowfile2:-
lines having |8| more text will route to this relation
Another field |8| more text
Flow:-
Created on 02-02-2018 09:54 PM - edited 08-17-2019 10:47 PM
Use RouteText Processor (The data is then routed according to these rules, routing each line of the text individually) and then configure the processor as
Route text Configs:-
Routing Strategy
Route to each matching Property Name
Matching Strategy
Contains
Ignore Leading/Trailing Whitespace
true
Ignore Case
true
Grouping Regular Expression No value set flowfile1
|1| more text //checks the line having the content and routes to flowfile1 relation
flowfile2
|8| more text //checks the line having the content and routes to flowfile1 relation
Input:-
Some fixed text |1| more text Another field |8| more text Last one |1| more text
Output:-
Flowfile1:-
as we are checking if the contents having |1| more text so the following lines will routes to flowfile1 relationship
Some fixed text |1| more text Last one |1| more text
Flowfile2:-
lines having |8| more text will route to this relation
Another field |8| more text
Flow:-
Created 02-05-2018 02:03 PM
@Shu, thank you very much. It worked perfectly!