Read file.dat with tfileinputregex

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

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

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