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

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

Definitive Guide to Data Quality

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

Download