how to read only First and Last lines of the File

One Star

how to read only First and Last lines of the File

I want to read only First and Last lines from the file. is it possible? do we have any component
Community Manager

Re: how to read only First and Last lines of the File

Hi
It is easy to read only first lines from a file, just need to set the header.
To read the last lines, you need use a tFileRowCount to get the number of lines first and then use a tSampleRow to read a range of lines, for more details, please see my screenshots.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: how to read only First and Last lines of the File

Thanks Shong.
Highlighted
One Star

Re: how to read only First and Last lines of the File

it seems like tFileRowCount component is having a bug in it.
if I select the option "IgnoreEmpty rows" with row separator as "\n" , it still counts the rows but with
System.getProperty("line.separator").toString()

in the row separator is ignoring the empty rows.
this is not the case in tFilePositional or any other file reading components.
Community Manager

Re: how to read only First and Last lines of the File

it seems like tFileRowCount component is having a bug in it.
if I select the option "IgnoreEmpty rows" with row separator as "\n" , it still counts the rows but with
System.getProperty("line.separator").toString()

in the row separator is ignoring the empty rows.
this is not the case in tFilePositional or any other file reading components.

Hi
Which version are you using? I tested it on v4.1.2 and it works.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: how to read only First and Last lines of the File

I have this problem on TDQ 4.0.1 R41260
Five Stars

Re: how to read only First and Last lines of the File

i'm not finding the screenshot for the post can you please share it

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch