Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to store extracted text values in re usable variables

Highlighted

How to store extracted text values in re usable variables

New Contributor

Hi Team,


We have a scenario, where we have a text file with data of table to be ingested into hive with comma separated values. Now we want to extract the text and store the extracted values in different variables. Stored variables we want to use in different processers. Please suggest us the way how to store extracted values in variables.


Thanks,

Ramesh.

3 REPLIES 3

Re: How to store extracted text values in re usable variables

@Ramesh Reddy

One processor that could work is the ExtractText processor.

Evaluates one or more Regular Expressions against the content of a FlowFile. The results of those Regular Expressions are assigned to FlowFile Attributes.

Re: How to store extracted text values in re usable variables

@Ramesh Reddy

*** Community Forum Tip: Try to avoid starting a new answer in response to an existing answer. Instead use comments to respond to existing answers. There is no guaranteed order to different answer which can make it hard following a discussion.

Now that you have FlowFile attributes, those values can be used as properties in other processors as long as the property states it supports the Expression language.

Without knowing which processor you want to use the attributes with, as an example I'll use the ExtractText/RouteOnAttribute processors in a simple flow.

In the ExtractText processor I'm looking for sessions where a user login is successful or fails, then I'll use that attribute to route the flow file down a path in the flow using those attributes in a RouteOnAttribute processor:

108554-screen-shot-2019-05-08-at-103632-am.png


108553-screen-shot-2019-05-08-at-103506-am.png

In the RouteOnAttribute I don't care what the actual value is, I just want to know if the value exists. If you want to use the actual value then the value would be just ${loginfail} instead for example.


screen-shot-2019-05-08-at-103406-am.png

Re: How to store extracted text values in re usable variables

New Contributor

@Wynnar I have used ExtractText processor but how to use those values in other components.

Please share the flow

Don't have an account?
Coming from Hortonworks? Activate your account here