Support Questions

Find answers, ask questions, and share your expertise

Help needed in replacing Pipe delimiter with CTRL-A delimiter.

Hi Team,

I have a file in local file system(LINUX) with fields delimited with "|"(pipe). I am trying to read the file and replace the "|" delimiter with CTRL-A delimiter. However I am not able to do it. I tried using a ReplaceText processor with search pattern as "|" & replace pattern as "\u0001".

Could you please help in resolving this query?

Thanks!

3 REPLIES 3

@Rohit Ravishankar

Are you using any processors prior to Replace Text processor? Like reading the file with delimiters because if you do so I believe the delimiters ill not be parse through the NiFi flow. And what it the output which you have got by following your approach? Is it not getting replaced completely or only few delimiters are replaced? If you could post more details on it , then It would be helpful to understand the scenario.

Hi Bala,

I am using ReplaceText processor to replace "|" delimiter to CTRL-A delimiter. However the pipe delimiters are not getting replaced by proper CTRL-A delimiter .

Below is my sample input & required output,

Input-

1|transaction|I|2017-03-28|Current 1|master|B|2017-03-28|Current 1|master|A|2017-03-28|Current

Output-

1^Atransaction^AI^A2017-03-28^ACurrent 1^Amaster^AB^A2017-03-28^ACurrent 1^Amaster^AA^A2017-03-28^ACurrent

Note - If the CTRL-A delimited file is viewed from Linux system using Vi editor, CTRL-A characters will be displayed as ^A.

Thanks!

@Rohit Ravishankar

Check out this answer to a similar question: https://community.hortonworks.com/answers/64633/view.html

Hope that helps!