I'm reading data from an object (OLE binary file) and need to find a way to split the data into an array or other format so I can obtain the few pieces of information I need. I'm not sure how this can be achieved.
The data comes in like this:
|some_other_delimited_data|RECORD=1|FIELD_1=A|FIELD_2=B|FIELD_3=C|RECORD=21|FIELD_1=C|FIELD_4=D|FIELD_5=E|RECORD=47|FIELD_6=F||RECORD=1|FIELD_1=G|FIELD_2=H|RECORD=37|FIELD_8=J|FIELD_9=K|FIELD_10=L|RECORD=40|FIELD_11=M|RECORD=47|FIELD_6=N|some_more_delimited_data|
Each data set starts with "RECORD=1" which contains a number of fields, followed by additional records. Each of these records (numbered 2-46) can occur multiple times and with a varying number of fields (ie RECORD=17 could occur five times and have a different number of fields for each one). The data set ends with RECORD=47 and its fields. A full set of data is contained between and including RECORD=1 and RECORD=47.
Multiple data sets exists so there are numerous "RECORD=1" to "RECORD=47" blocks that I need to get data from.
Each RECORD can have a varying number of fields.
Everything is separated by a "|" delimiter and there doesn't seem to be any other delimiters in the stream.
For each data set, I need to get:
- From RECORD=24, the data from FIELD_1 where FIELD_2="FOO"
- From RECORD=31, the data from FIELD_1 where FIELD_2="BAR"
How can this be done? I have multiple files that data needs to be pulled from each containing multiple data sets so it needs to be fairly efficient.