You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Shawn Weeks <sw...@weeksconsulting.us> on 2018/06/25 20:09:32 UTC
ReplaceText Special Character
I feel this is probably really simple but I'm trying to replace the delimiter in a text file with '\001' to match Hive's default delimiter. Here is my config which is based on a Hortonworks post from 2016 but it's not inserting ctrl+a it's inserting the string '\001'.
Thanks
Shawn
[cid:4d5c5505-9a50-4929-b579-8ff9ac068570]
Re: ReplaceText Special Character
Posted by Shawn Weeks <sw...@weeksconsulting.us>.
It looks like URL Strings are just 2 characters not 3 but ${literal('%01'):urlDecode()} seems to work. Jagrut's example follows another idea I had where I was planning on storing the actual character used in a lookup since it appears you can store non printing characters in attributes.
Thanks
Shawn
________________________________
From: Mark Payne <ma...@hotmail.com>
Sent: Tuesday, June 26, 2018 7:19:23 AM
To: users@nifi.apache.org
Subject: Re: ReplaceText Special Character
Shawn,
There are certainly a few different ways to handle this. Unfortunately, it may not be as simple and straight-forward
as you might expect, because you're trying to replace text with some non-readable characters. Jagrut's method should
certainly work. However, a simpler solution, I think, would be to just modify your "Replacement Value" in ReplaceText
and do something a bit 'clever':
${literal('%001'):urlDecode()}
Here, we are replacing the value with the literal value %001 (the URL-encoded version of \u001 and then we are asking
the Expression Language to URL-Decode it. This should give you back the Unicode 001 character that you're looking for.
Thanks!
-Mark
On Jun 25, 2018, at 7:19 PM, Jagrut Sharma <ja...@gmail.com>> wrote:
Hi - You can try this approach to replace the incoming delimiter with Hive's Ctrl-A delimiter.
Flow1 -> ExecuteScript -> ReplaceText -> Flow2
ExecuteScript configuration
<image.png>
ReplaceText configuration
<image.png>
The text will be replaced with ^A delimiter which you can verify in vi.
Thanks.
--
Jagrut
On Mon, Jun 25, 2018 at 1:09 PM, Shawn Weeks <sw...@weeksconsulting.us>> wrote:
I feel this is probably really simple but I'm trying to replace the delimiter in a text file with '\001' to match Hive's default delimiter. Here is my config which is based on a Hortonworks post from 2016 but it's not inserting ctrl+a it's inserting the string '\001'.
Thanks
Shawn
<nifi_example.png>
--
Jagrut
Re: ReplaceText Special Character
Posted by Mark Payne <ma...@hotmail.com>.
Shawn,
There are certainly a few different ways to handle this. Unfortunately, it may not be as simple and straight-forward
as you might expect, because you're trying to replace text with some non-readable characters. Jagrut's method should
certainly work. However, a simpler solution, I think, would be to just modify your "Replacement Value" in ReplaceText
and do something a bit 'clever':
${literal('%001'):urlDecode()}
Here, we are replacing the value with the literal value %001 (the URL-encoded version of \u001 and then we are asking
the Expression Language to URL-Decode it. This should give you back the Unicode 001 character that you're looking for.
Thanks!
-Mark
On Jun 25, 2018, at 7:19 PM, Jagrut Sharma <ja...@gmail.com>> wrote:
Hi - You can try this approach to replace the incoming delimiter with Hive's Ctrl-A delimiter.
Flow1 -> ExecuteScript -> ReplaceText -> Flow2
ExecuteScript configuration
<image.png>
ReplaceText configuration
<image.png>
The text will be replaced with ^A delimiter which you can verify in vi.
Thanks.
--
Jagrut
On Mon, Jun 25, 2018 at 1:09 PM, Shawn Weeks <sw...@weeksconsulting.us>> wrote:
I feel this is probably really simple but I'm trying to replace the delimiter in a text file with '\001' to match Hive's default delimiter. Here is my config which is based on a Hortonworks post from 2016 but it's not inserting ctrl+a it's inserting the string '\001'.
Thanks
Shawn
<nifi_example.png>
--
Jagrut
Re: ReplaceText Special Character
Posted by Jagrut Sharma <ja...@gmail.com>.
Hi - You can try this approach to replace the incoming delimiter with
Hive's Ctrl-A delimiter.
Flow1 -> ExecuteScript -> ReplaceText -> Flow2
*ExecuteScript configuration*
*ReplaceText configuration*
The text will be replaced with ^A delimiter which you can verify in vi.
Thanks.
--
Jagrut
On Mon, Jun 25, 2018 at 1:09 PM, Shawn Weeks <sw...@weeksconsulting.us>
wrote:
> I feel this is probably really simple but I'm trying to replace the
> delimiter in a text file with '\001' to match Hive's default delimiter.
> Here is my config which is based on a Hortonworks post from 2016 but it's
> not inserting ctrl+a it's inserting the string '\001'.
>
>
> Thanks
>
> Shawn
>
>
>
>
--
Jagrut