Support Questions

Find answers, ask questions, and share your expertise

How to ExtractText from flow file using Nifi Processor?

avatar

Hello,

splittext flow file

flowfile example,

Delimiter ';'

1096;2017-12-29;2018-01-08;10:07:47;2018-01-10;Jet01

Attribute 1 : 1096

Attribute 2 : 2017-12-29

Attribute 3 : 2018-01-08

Attribute 4 : 10:07:47

Attribute 5 : 2018-01-10

Attribute 6 : Jet01

how can I set the Attiribute?

FlowFile

51401-flowfile.jpg

SplitText

51402-splittext.jpg

ExtractText

51396-extracttext.jpg

Please help me

4 REPLIES 4

avatar

What exactly are you trying to achieve? It might be easiest to use one of the Record processors with a CSV reader.

avatar

text data import table.

Data share text format in ftp.

I will add the incoming data to the table. How do I split the columns into columns. How to define column values as properties with ExtractText

avatar
Master Guru

@Murat Menteşe

In Extract Text processor add new properties in configure menu by clicking on the + sign at right corner.

Configs:-

Attribute 1

(.*?);

Attribute 2

.*?;(.*?);

Attribute 3

;.*?;(.*?);

Attribute 4

^.*;.*;(.*);.*;

Attribute 5

^.*;.*;.*;(.*);

Attribute 6

^.*;.*;.*;.*;(.*)

Screenshot:-

51408-extracttext.png

(Or)

Add properties with below regex matches

Attribute 1

(.*?);

Attribute 2

.*?;(.*?);

Attribute 3

;.*?;(.*?);

Attribute 4

.*?;.*?;.*?;(.*?);

Attribute 5

.*?;.*?;.*?;.*?;(.*?);

Attribute 6

.*?;.*?;.*?;.*?;.*?;(.*)

Screenshot:-

51410-extracttext.png

Output:-

51409-output.png

As you can see in above output screenshot both regex matches and gives same results once we extract all the contents as attributes then you can use expression language like ${Attribute 1} to get 1096 value ..etc.

**Note**

Keep no space in attribute names like Attribute_1 instead of Attribute 1,that would be easy to retrieve attribute value inside NiFi Flow. Change the Attribute names without spaces in Extract Text Processor.

.

If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of errors.

avatar
Explorer

 

@Shu_ashu Which processor do you use to get this attributes? Is it UpdateAttribute?

As you can see in above output screenshot both regex matches and gives same results once we extract all the contents as attributes then you can use expression language like ${Attribute 1} to get 1096 value ..etc.