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.
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