Re: Using ReplaceText to insert newline character into flowfile?

2016-08-03 Thread Andy LoPresto
Carl, This is a great suggestion. I think you can improve the performance of your script by moving the StringBuilder outside of the loop (or even further, simply reading all the lines into a list and joining them with the delimiter you want): import java.nio.charset.StandardCharsets log.info("A

Re: Using ReplaceText to insert newline character into flowfile?

2016-08-02 Thread Jake Kugel
Interesting, hadn't looked at using ExecuteScript before this but looks like ExecuteScript and Groovy would let me do what I need to do, I will try that approach. Thanks, Jake On 7/28/16 2:02 PM, Carl Berndt wrote: Hey Jake, I had a similar issue recently. I used this .groovy script : impo

Re: Using ReplaceText to insert newline character into flowfile?

2016-07-28 Thread Carl Berndt
Hey Jake, I had a similar issue recently. I used this .groovy script : import java.nio.charset.StandardCharsets log.info("Add backslash R with Groovy!") ; def flowFile = session.get(); if (!flowFile) return; flowFile = session.putAttribute(flowFile, 'my-property', 'my-value'); flowFile = session

Re: Using ReplaceText to insert newline character into flowfile?

2016-07-21 Thread Jake Kugel
Thanks, creating the newline in the replacement value property with shift-enter worked! The newline character (0x0a) was inserted into the flowfile. My use case is slightly more involved, I also need to insert carriage returns (0x0d) in some cases. But I think you've given me a direction to

Re: Using ReplaceText to insert newline character into flowfile?

2016-07-21 Thread Joe Witt
Jake, In the 'Replacement Value' you can tell it what you want then you can hit "Shift-Enter" and it will insert the newline. So, lets say the input you're getting into this processor is a flowfile containing a bunch of line seperated events. If you wanted to insert a newline in between each lin

Re: Using ReplaceText to insert newline character into flowfile?

2016-07-21 Thread Jake Kugel
Thanks for the reply. I tried just now using \\n with the regex replace strategy, and it put '\n' into the flowfile instead of 'n'. Jake On 7/21/16 10:22 PM, Joe Witt wrote: Jake, Can you give \\n a try on the regex replace strategy? Let us know if that does it. Thanks Joe On Thu, Jul 21,

Re: Using ReplaceText to insert newline character into flowfile?

2016-07-21 Thread Joe Witt
Jake, Can you give \\n a try on the regex replace strategy? Let us know if that does it. Thanks Joe On Thu, Jul 21, 2016 at 11:18 PM, Jake Kugel wrote: > Hello, > > Is it possible to use ReplaceText processor to insert a newline character > (0x0a) or other special characters into a flowfile?

Using ReplaceText to insert newline character into flowfile?

2016-07-21 Thread Jake Kugel
Hello, Is it possible to use ReplaceText processor to insert a newline character (0x0a) or other special characters into a flowfile? I've tried putting \r and \n in the value of ReplaceText's Replacement Value property, but they are inserted literally into the file (the Regex Replace strateg