Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to read a TXT file with Sections on it?

Hi,

I have this kind of file to read:

As we can see, there are sections on it, it starts with the Start word and finishes on the line before the next Start word.

Starting from the lines that starts with # the file is configured on fixed possitions.

How can I read this file having the contents in sections?

I know how to read fixed positions file, but the position is just when I have # on it and the data in the section refers to the Start/Stop lines.

Start 07:59:51 CC640WB

Stop 11:38:15 10

#2 [Traceability ] 1246 1196 0 50 5

#3 [Pen ] 16013 16013 0 0 5

#4 [1UP PICA ] 16021 16021 0 0 5

#5 [1UP UPC ] 15989 15987 0 2 5

#6 [ITF14 ] 280 270 6 4 5

#7 [1UPcheckweight ] 0 0 0 0 5

#8 [Markem ] 0 0 0 0 5

#9 [ATI ] 0 0 0 0 5

#10 [ATI Monitor ] 0 0 0 0 10

#11 [RFID ] 0 0 0 0 10

Start 11:39:09 CC636WB

Stop 12:56:16 10

#2 [Traceability ] 453 429 0 24 5

#3 [Pen ] 5775 5775 0 0 5

#4 [1UP PICA ] 5779 5779 0 0 5

#5 [1UP UPC ] 5773 5772 0 1 5

#6 [ITF14 ] 100 98 0 2 5

#7 [1UPcheckweight ] 0 0 0 0 5

#8 [Markem ] 0 0 0 0 5

#9 [ATI ] 0 0 0 0 5

#10 [ATI Monitor ] 0 0 0 0 10

#11 [RFID ] 0 0 0 0 10

Start 12:57:00 C8728AB

Stop 14:18:14 10

#2 [Traceability ] 457 430 0 27 5

#3 [Pen ] 5770 5769 0 1 5

#4 [1UP PICA ] 5777 5776 0 1 5

#5 [1UP UPC ] 5767 5767 0 0 5

#6 [ITF14 ] 102 100 0 2 5

#7 [1UPcheckweight ] 0 0 0 0 5

#8 [Markem ] 0 0 0 0 5

#9 [ATI ] 0 0 0 0 5

#10 [ATI Monitor ] 0 0 0 0 10

#11 [RFID ] 0 0 0 0 10

Start 14:20:44 CH561HB

Stop 15:38:55 10

#2 [Traceability ] 451 428 0 23 5

#3 [Pen ] 5772 5769 3 0 5

#4 [1UP PICA ] 5777 5777 0 0 5

#5 [1UP UPC ] 5780 5778 0 2 5

#6 [ITF14 ] 98 97 0 1 5

#7 [1UPcheckweight ] 0 0 0 0 5

#8 [Markem ] 0 0 0 0 5

#9 [ATI ] 0 0 0 0 5

#10 [ATI Monitor ] 0 0 0 0 10

1 Solution

Accepted Solutions
spividori
Specialist
Specialist

Hi.

Well, I did not understand the query, check if it works now.

Regards.

View solution in original post

5 Replies
spividori
Specialist
Specialist

Hi.

See example. I hope to help you.

Regards.

Not applicable
Author

Hi,

Thanks for the help, but this is not a complete solution for me.

I also need the values from the lines that starts with "Start" and "Stop".

The group of data that starts with "#" refers to the "Start" and "Stop" lines.

I need to have a way to have a link with the Start and Stop and the lines with #.

BR,

Cassiano

spividori
Specialist
Specialist

Hi.

Well, I did not understand the query, check if it works now.

Regards.

Not applicable
Author

Wow...

This is perfect.

This is how I need the data.

Thank you so much.

BR,

Cassiano

Not applicable
Author

Hi, Sandro Pividori

Thank you so much!

The attach file is really helpful.

Best regards,

Mica Gordon