You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by jamesburn <Ja...@oup.com> on 2015/11/19 14:43:46 UTC
Camel Simple deal with line breaks
Hi
I'm trying to get the stdout of an exec command to be used in my header.
stdout is putting a linebreak on the end of the string I want to put into my
header and this is causing trouble later on (difficulty with regex and I'm
not sure what else).
I see Simple strips whitespace by default (trim="true"). How can I get it to
ditch any line-breaks?
Here's what I've got.
<to uri="exec:hackapartPDFtoGetDeliveryNo.sh">
<convertBodyTo type="String"/>
<setHeader headerName="DeliveryNoFromPDF">
<simple>${body}</simple>
</setHeader>
<log message="DeliveryNoFromPDF is ${in.header.DeliveryNoFromPDF}"></log>
Any thoughts?
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Simple-deal-with-line-breaks-tp5774105.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Simple deal with line breaks
Posted by jamesburn <Ja...@oup.com>.
Hi Yogesh
Thanks - yes, I guess I could use split. I was angling for a “Simple” based
solution, or doing something when I convert the body to String.
For now I’m stripping the trailing linebreak from the stdout in the shell
script.
I'll have to watch that in future.
Thanks
James
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Simple-deal-with-line-breaks-tp5774105p5774148.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Simple deal with line breaks
Posted by yogu13 <yo...@gmail.com>.
How about using .split(body(String.class).tokenize("\n")) ??
Regards,
-Yogesh
--
View this message in context: http://camel.465427.n5.nabble.com/Camel-Simple-deal-with-line-breaks-tp5774105p5774142.html
Sent from the Camel - Users mailing list archive at Nabble.com.