Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

apache Nifi getsftp regex filter??

avatar
Explorer

Hi, I am using Apache Nifi to create a flow to using GetSFTP processor. I need to select the correct file for each flow separately in a single path . Can somebody help me with the correct regex expression for the below given file names: [EUtranCellRelation]_[LD10970]_[A20190131.0445] and [EUtranCellFDD]_[LD10970]_[A20190131.0445] Both the files are in the same path but I need to select each file for separate flow using the correct filter regex expression.

3 REPLIES 3

avatar
Explorer

[EUtranCellRelation] *.csv or [EUtranCellFDD] *.csv logix should be somewhat like this? the rest of the values are dynamically generated

avatar
Master Guru

@Rohit Bhattacharya

Try with \[EUtranCellRelation\].*\.csv ,\[EUtranCellFDD\] *\.csv in GetSFTP processors.

(or)

Use RouteOnAttribute processor and filter out the files by matching filenames.

Flow:

1.GetSFTP processor
2.RouteOnAttribute //keep matching nifi expression to match files

Use NiFi expression language add two properties in RouteOnAttribute processor

${filename:startsWith('\[EUtranCellRelation\]')}

(or)

${filename:contains('\[EUtranCellRelation\]')}

Then matching files will be routed to the corresponding properties.

Refer this and this links for more details.

avatar
Explorer

Thanks a lot @Shu will try and let you know how it went