You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Baalu <go...@gmail.com> on 2013/05/14 04:27:11 UTC

Numbers of lines in a flat file

Hello,

I am trying to count the number of the lines in a flatfile, once I get that
value I need to write it back to the flat file as part of the file footer. 

For now I did this:

from("direct:fileLinecount").routeId("fileCount")
					.pollEnrich("file://C:/filefolder?noop=true")
				    .split().tokenize("\n").....

I can see one of the property as "CamelSplitSize" which has the number of
the lines in the flat file. How to access this property? I am unable to get
this value in my route with getProperty...any help would be appreciated.

thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/Numbers-of-lines-in-a-flat-file-tp5732455.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Numbers of lines in a flat file

Posted by James Carman <ja...@carmanconsulting.com>.
http://camel.apache.org/splitter.html


On Wed, Jul 31, 2013 at 8:50 PM, jabe <ja...@gmail.com> wrote:
> How did you get the number of lines from header? Which Camel component did
> you use?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Numbers-of-lines-in-a-flat-file-tp5732455p5736604.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Numbers of lines in a flat file

Posted by jabe <ja...@gmail.com>.
How did you get the number of lines from header? Which Camel component did
you use?



--
View this message in context: http://camel.465427.n5.nabble.com/Numbers-of-lines-in-a-flat-file-tp5732455p5736604.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Numbers of lines in a flat file

Posted by Baalu <go...@gmail.com>.
thanks for responding...

I was able to get it from header. thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/Numbers-of-lines-in-a-flat-file-tp5732455p5732625.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Numbers of lines in a flat file

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Seems a bit overkill to use EIP patterns to count the number of lines in a file.

Maybe use a java method call for that instead with code to read the
lines, and then at the end you can append the data also
http://javarevisited.blogspot.se/2012/07/read-file-line-by-line-java-example-scanner.html

Then call the java method from the Camel route etc.
http://camel.apache.org/bean


On Tue, May 14, 2013 at 4:27 AM, Baalu <go...@gmail.com> wrote:
> Hello,
>
> I am trying to count the number of the lines in a flatfile, once I get that
> value I need to write it back to the flat file as part of the file footer.
>
> For now I did this:
>
> from("direct:fileLinecount").routeId("fileCount")
>                                         .pollEnrich("file://C:/filefolder?noop=true")
>                                     .split().tokenize("\n").....
>
> I can see one of the property as "CamelSplitSize" which has the number of
> the lines in the flat file. How to access this property? I am unable to get
> this value in my route with getProperty...any help would be appreciated.
>
> thanks!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Numbers-of-lines-in-a-flat-file-tp5732455.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Numbers of lines in a flat file

Posted by Baalu <go...@gmail.com>.
CamelSplitSize (or equivalent) is not part of headers.



--
View this message in context: http://camel.465427.n5.nabble.com/Numbers-of-lines-in-a-flat-file-tp5732455p5732458.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Numbers of lines in a flat file

Posted by Christian Posta <ch...@gmail.com>.
Try getting it from the headers.


On Mon, May 13, 2013 at 7:27 PM, Baalu <go...@gmail.com> wrote:

> Hello,
>
> I am trying to count the number of the lines in a flatfile, once I get that
> value I need to write it back to the flat file as part of the file footer.
>
> For now I did this:
>
> from("direct:fileLinecount").routeId("fileCount")
>
> .pollEnrich("file://C:/filefolder?noop=true")
>                                     .split().tokenize("\n").....
>
> I can see one of the property as "CamelSplitSize" which has the number of
> the lines in the flat file. How to access this property? I am unable to get
> this value in my route with getProperty...any help would be appreciated.
>
> thanks!
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Numbers-of-lines-in-a-flat-file-tp5732455.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta