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 use splittext one line value to set next processor attribute

Solved Go to solution
Highlighted

how to use splittext one line value to set next processor attribute

Contributor

I use splittext processor to split a file per line, for its destination processor, how to set attribute using splitted value?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: how to use splittext one line value to set next processor attribute

Contributor

Thanks, I used "(.+)" set the attribute value.

View solution in original post

2 REPLIES 2
Highlighted

Re: how to use splittext one line value to set next processor attribute

Hi @awen hu

I'd use 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. Regular Expressions are entered by adding user-defined properties; the name of the property maps to the Attribute Name into which the result will be placed. The first capture group, if any found, will be placed into that attribute name.But all capture groups, including the matching string sequence itself will also be provided at that attribute name with an index value provided, with the exception of a capturing group that is optional and does not match - for example, given the attribute name "regex" and expression "abc(def)?(g)" we would add an attribute "regex.1" with a value of "def" if the "def" matched. If the "def" did not match, no attribute named "regex.1" would be added but an attribute named "regex.2" with a value of "g" will be added regardless.The value of the property must be a valid Regular Expressions with one or more capturing groups. If the Regular Expression matches more than once, only the first match will be used. If any provided Regular Expression matches, the FlowFile(s) will be routed to 'matched'. If no provided Regular Expression matches, the FlowFile will be routed to 'unmatched' and no attributes will be applied to the FlowFile.

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.ExtractText/in...

Hope this helps.

Highlighted

Re: how to use splittext one line value to set next processor attribute

Contributor

Thanks, I used "(.+)" set the attribute value.

View solution in original post

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