Read file.dat with tfileinputregex

Highlighted
Seven Stars

Read file.dat with tfileinputregex

Hi,

I would like to read file.dat with tfileInputRegex.

Here is a screenshot of the file:

Capture.PNG

So,I need to distinguish the parts of the file by the beginning of the word "LB" because each time there is an LB it is new data to extract and i need to retrieve three fields that are framed in red.

I tried these exprssions but I still get an error

"^LB"+
"([A-Z]\\.*)"+
"^([0-9]{8}T[0-9]{6}\\.[0-9]{3}Z)"+
"([0-9]*\\.[0-9]*)|(^-[0-9]*\\.[0-9]*)|[\\?]"

 

Thanks in advance.

Best regards.

Fifteen Stars TRF
Fifteen Stars

Re: Read file.dat with tfileinputregex

Your explaination is not very clear as you speak about 3 fields circled in red but there only 1 for lines starting with LB. Also, you don't say anything about other fields also circled in red.
I suggest you to give us the expected result based on this sample.

TRF
Seven Stars

Re: Read file.dat with tfileinputregex

I try to be clear
The file.dat contains values from several sensors. I can distinguish the data of a sensor by the LB. When there is LB, it means a new sensor

I need to create 3 fields (name, value, date) to recover the fields of the sensors
-Name (which is the name of the sensor) is in the line that contains LB
 -value,date begen starts from the third line until the start of a new sensor (an anothor line with LB)

Knowing for value I can find negative values or "?" or simple value 

Here is the expected result:


t.PNG

My need is to create a pattern with regex to create this fields.

 

Thanks in advance.

Four Stars

Re: Read file.dat with tfileinputregex

you can achive this using tfileinputdelimited also. Only in column0 you have to  put LB externally.2nd_step_delimited.PNG3rd_step_delimited_file.PNG

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