Read a input file without '\n'

Highlighted
Four Stars

Read a input file without '\n'

Hi, 

I need to read a file which not contains '\n'. It looks like :

"first field 1 second field 1 first field 2 second field 2 first field 3 second field 3 first field 4 second field 4....."

I have to put this file in two columns like this:

column 1                  column 2

first field 1                 second field 1

first field 2                 second field 2

first field 3                 second field 3

 

This is fixed field but I can't use t File input Positional object because my file doesn't contains separator of lines like '\n'.

 

Can you help me please?


Accepted Solutions
Highlighted
Four Stars

Re: Read a input file without '\n'

Thank you very much for your help!

 

I try your method but finally I was easier to use a t-Java-Flex to read my file in stream, line by line as I wanted. After I used a t-map with some functions that I wrote in Java as a routine to separate each line in 2 columns.

 

 

 

View solution in original post


All Replies
Highlighted
Sixteen Stars
Sixteen Stars

Re: Read a input file without '\n'

You tFileInputRaw to get the content, then you need to split the input every n characters (see String.split() method) and push the result to a file you can now read as a positional file.
That's the general idea.

TRF
Highlighted
Four Stars

Re: Read a input file without '\n'

Thank you very much for your help!

 

I try your method but finally I was easier to use a t-Java-Flex to read my file in stream, line by line as I wanted. After I used a t-map with some functions that I wrote in Java as a routine to separate each line in 2 columns.

 

 

 

View solution in original post

2019 GARTNER 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

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog