Support Questions

Find answers, ask questions, and share your expertise

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

Explorer

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

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.

View solution in original post

2 REPLIES 2

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.

Explorer

thanks @shu

its working like charm
@Shu

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.