Ask Your Question
0

Replace all . with _ in field names

asked 2018-09-17 16:13:47 -0500

todd gravatar image

How can I replace the character . with a _ character in all field names?

I'd like to do it in Field Renamer (if possible) rather than a Groovy processor such as described here https://ask.streamsets.com/question/7...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-09-17 16:29:19 -0500

jeff gravatar image

updated 2018-09-17 16:36:45 -0500

Did you see this Q&A? You can extend the approach described there. Also, this one is more directly related to what you're doing.

edit flag offensive delete link more

Comments

I'm regex challenged. I've found all kinds of examples for removing content from strings like the Q&A you mention, but nothing yet on replacing a char as described.

todd gravatar imagetodd ( 2018-09-17 16:33:16 -0500 )edit

Edited with a new link that is more directly relevant. You will just use '\.' instead of space and add a '_' in between the replacement parts.

jeff gravatar imagejeff ( 2018-09-17 16:37:26 -0500 )edit

When I try /'([^\.]*) ([^_]*)' in Source Field and then /$1$2 in Target, exception com.streamsets.pipeline.api.base.OnRecordErrorException: FIELD_RENAMER_00 - Record 'rawData::0' does not contain fields '/'([^\.]*) ([^_]*)'' at com.streamsets.pipeline.stage.processor.fieldrenamer.FieldRena

todd gravatar imagetodd ( 2018-09-17 16:50:33 -0500 )edit

This should work: Source Field == /'([^ ]*)\.([^ ]*)' and Target Field == /$1_$2

iamontheinet gravatar imageiamontheinet ( 2018-09-17 16:56:33 -0500 )edit

same exception but slightly different... com.streamsets.pipeline.api.base.OnRecordErrorException: FIELD_RENAMER_00 - Record 'rawData::0' does not contain fields '/'([^ ]*)\.([^ ]*)'' In case it matters, I'm using a pipleine with a Dev Raw Data Source to send through key/value pairs

todd gravatar imagetodd ( 2018-09-17 17:04:48 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-09-17 16:13:47 -0500

Seen: 40 times

Last updated: Sep 17