Saharsh Kislaya
Saharsh Kislaya

Reputation: 75

Parsing fix width file using nifi

I am very new to NiFi and trying to solve the following scenario:

I have a fixed width file in the following format:

AAAAAxbnkdf      fg kjsdkgghjkg  
CCCCCjljdsjglg  gjg dkljgllkjds  
EEEEEEkljdfgkd jksf sbgjsdljkga  
AAAAAxbnkdfsfg grgh kjsdkgghjkg  
CCCCCjljdsjgl  jdjd jgdkljglsds  

I want to scan each line of the file and check for lines starting with AAAAA or CCCCC. The output should be three different flow files where the first file should contain all the lines starting with AAAAA, the second file should contain all the lines starting with CCCCC and the third flow file should contain all the other lines.

Upvotes: 2

Views: 1592

Answers (1)

James
James

Reputation: 11931

Try the RouteText processor. You will need to do a bit of configuration and add dynamic properties for the 'AAAAA' and 'CCCCC' lines:

  • Routing Strategy: Route to each matching Property Name
  • Matching Strategy: Starts With
  • AAAAA: AAAAA
  • CCCCC: CCCCC

After making these changes, the processor will have output relationships for 'AAAAA', 'CCCCCC', and 'unmatched' (for everything else).

Upvotes: 4

Related Questions