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 split file name with delimeter '_' and stored values in variable using Nifi?

SOLVED Go to solution
Highlighted

How to split file name with delimeter '_' and stored values in variable using Nifi?

New Contributor

Hi,

I want to split that file name('_') and store split values in variable for further operation.

The file name is combination of various parameter.

file Name = BBAS_2018091873_COEP_20180918141337_Cleaned_txt_scorable.csv

Stores the values in variable like,

like a=BBAS ,b=2018091873 , c=COEP, d=20180918141337 , e=Cleaned, f=txt , g=scorable.csv

Thanks in advance!!!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to split file name with delimeter '_' and stored values in variable using Nifi?

Super Guru
@Mitthu Wagh

Use getDelimitedField function and use UpdateAttribute processor and add new properties like.

a

${fileName::getDelimitedField(1,'_')}

b

${fileName::getDelimitedField(2,'_')} 

By using getDelimitedField function we are going to add all the attributes you needed.

-

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 issues.

2 REPLIES 2

Re: How to split file name with delimeter '_' and stored values in variable using Nifi?

Super Guru
@Mitthu Wagh

Use getDelimitedField function and use UpdateAttribute processor and add new properties like.

a

${fileName::getDelimitedField(1,'_')}

b

${fileName::getDelimitedField(2,'_')} 

By using getDelimitedField function we are going to add all the attributes you needed.

-

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 issues.

Re: How to split file name with delimeter '_' and stored values in variable using Nifi?

New Contributor

thanks @shu

its working like charm
@Shu