[resolved] Breaking up a file by lines using cSplitter

One Star

[resolved] Breaking up a file by lines using cSplitter

Hello,
I have a Route which loads a file with a cFile component. At this point I would like to process a seperate message for each line in the file. I have been trying to do this using the cSplitter component but so far I still just get one message with the entire file contents. It seems like I must be missing something obvious, can anyone help me?
Thanks!
Drew

Accepted Solutions
One Star

Re: [resolved] Breaking up a file by lines using cSplitter

Thanks Edward, the example code helped get me started. I needed to use body(String.class).tokenize("\n") as the Expression for my cSplitter component.

All Replies
Employee

Re: [resolved] Breaking up a file by lines using cSplitter

There is an example of using splitter with a text file here http://www.talendforge.org/forum/viewtopic.php?id=23667 . A bit complex for your case but you can download the example and it should answer your question.
One Star

Re: [resolved] Breaking up a file by lines using cSplitter

Thanks Edward, the example code helped get me started. I needed to use body(String.class).tokenize("\n") as the Expression for my cSplitter component.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

An API-First Approach to Modernizing Applications

Learn how to use an API-First Approach to Modernize your Applications

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read