Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Separate CSV column by delimiter or whitespace

avatar
Explorer

I have a csv where one of the columns can sometimes come as a pair such as:

Column_name
1 , 2
2.5 3.2
2.9 - 3.2

The delimiter can potentially be anything really, but there will be a delimiter. Also the values will only come as pairs.

 

My question is, is there an efficient way to separate this one column into a flowfile where each value has it's own column, such that I have the following result:

Column #1Column #2
12
2.5 3.2

 

Thank you

1 REPLY 1

avatar
Super Guru

Hi ,

Not sure if this is possible with out of the box processor. I can think of ReplaceText first to replace different delimiters like (-) or white-space (\s) to common delimiter like (,) however if there is a white space before or after other delimiters like (-) or (,) its not going to work. Another option is to use ExecuteScript processor where you try to read each line (after the header) from the flowfile content and then use string split function and try it with different delimiter, once you get two array elements you construct your new string with the new column header and delimiter and transfer to the success relationship.