0

I need to parse a single entry of a dump file. I've tried more than a few iterations of my template, and I keep getting only the entries of the first stanza.

Here is my template:

Value Route1 (\d+)
Value Route2 (\d+)
Value Route3 (\d+)
Value Route4 (\d+)

Start
  ^    BRTE 250 
  ^    SP\s+${Route1} 
  ^    3AU\s+${Route2} 
  ^    56C\s+${Route3} 
  ^    64C\s+${Route4}  -> Record

...and here is a truncated version of the file. The actual file is hundreds of stanzas long, with spaces at the beginning and end of every line, and between each of the stanzas. I need to extract the values under each BRTE. I am iterating through the list of BRTEs, and dynamically creating a new template file in every loop, changing the BRTE number, each time.:

    BRTE 1 
    SP   1 
    3AU  1 
    56C  1 
    64C  1 
    DFLG NO 
    
    BRTE 250 
    SP   250 
    3AU  250 
    56C  250 
    64C  250 
    DFLG NO 
    
    BRTE 251 
    SP   251 
    3AU  251 
    56C  251 
    64C  251 
    DFLG NO 

For this example, I ONLY want the numbers from entry 250. My code prepends the BRTE number to the beginning of the row provided by the template, with each loop. Here is a section of the output I am getting.:

['1','1','1','1','1']
['250','1','1','1','1']
['251','1','1','1','1']

Here is what I want.:

['1','1','1','1','1']
['250','250','250','250','250']
['251','251','251','251','251']

Thanks, in advance.

0 Answers0