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 extract specific fields from a CSV file using NiFi

How to extract specific fields from a CSV file using NiFi

92453-samplecsv.jpg

0favorite

I have a csv file say with 100+ columns and I want to extract only specific 60 columns as a subset(both column name + its value). I know we can use Extract Text processors. Can anyone tell me what regular expression to write? Ex- Lets say from the given snapshot I only want NiFi to Extract 'BMS_sw_micro', 'BMU_Dbc_Dbg_Micro', 'BMU_Dbc_Fia_Micro' columns i.e. Extract only column 'F,L,O'.

any help is much appreciated!

1 REPLY 1
Highlighted

Re: How to extract specific fields from a CSV file using NiFi

New Contributor

@shraddha srivastav, Bit late but try this...

^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,([^,]*),[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,([^,]*),[^,]*,[^,]*,([^,]*)\S*

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