Extract data after detecting particular information in a CSV file

Six Stars

Extract data after detecting particular information in a CSV file

Hello, I have a csv file (~ 40000 lines), at the beginning and at the end of the file I have technical information. I would like to retrieve particular information by detecting data :
"END OF REPORT","Selection Criteria"
,,,,,,,,,
,"Period:","05/2018",
I would like to extract the Period data after the END OF REPORT : "05/2018".

How can I do that ?

EDIT : Maybe I have to use Regex ?

Thanks

Accepted Solutions
Eleven Stars

Re: Extract data after detecting particular information in a CSV file

after reading data ad tmap with 1 boolean var named endOfCsvFile
first detect "END OF REPORT" to set it as true.
var.endOfCsvFile || row1.col1.equals("END OF REPORT")

filter the output of the tmap (stop sending data when endOfCsvFile is true)

add a new output to outPeriald add filter on this output
to retive row1.col3 only when row1.col2.equals("Periode")

Francois Denis

Tag as "solved" for others! Kudos to thanks!


All Replies
Eleven Stars

Re: Extract data after detecting particular information in a CSV file

after reading data ad tmap with 1 boolean var named endOfCsvFile
first detect "END OF REPORT" to set it as true.
var.endOfCsvFile || row1.col1.equals("END OF REPORT")

filter the output of the tmap (stop sending data when endOfCsvFile is true)

add a new output to outPeriald add filter on this output
to retive row1.col3 only when row1.col2.equals("Periode")

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Six Stars

Re: Extract data after detecting particular information in a CSV file

Thanks for your reply. It works fine.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch