I have a plain text file that contains a series of data sectioned by a header, I give an example:
### CONSENT00801 Consent Values CONSENTONE00801+ Z00801.3, CONSENTTWO+ Z00801.7 ###
CONSENTONE0080101 half hourly
CONSENTONE0080102 daily
CONSENTONE0080103 monthly
CONSENTTWO0080101 half hourly
CONSENTTWO0080102 daily
CONSENTTWO0080103 monthly
### CONSENT00803 Consent Values CONSENTONE00803+ Z00803.3, CONSENTTWO00803+ Z00803.8 ###
CONSENTONE0080301 half hourly
CONSENTONE0080302 daily
CONSENTONE0080303 monthly
CONSENTTWO0080301 half hourly
CONSENTTWO0080302 daily
CONSENTTWO0080303 monthly
### DDIVISION00801 Division i.e. fuel type DIVISIONONE00801 + Z00801.1, DIVISIONTWO00801 + Z00801.5 ###
DIVISIONONE0080101 electricity
DIVISIONONE0080102 gas
DIVISIONTWO0080101 electricity
DIVISIONTWO0080102 gas
As you can see, the headers have common patterns, for example, they always start with three pads followed by three spaces.
My goal is to read from a text file only the lines below one of these headers, that is, all the lines of a section, for example, read the entries in the section ...
### CONSENT00803 Consent Values CONSENTONE00803+ Z00803.3, CONSENTTWO00803+ Z00803.8 ###
That they are being ...
CONSENTONE0080301 half hourly
CONSENTONE0080302 daily
CONSENTONE0080303 monthly
CONSENTTWO0080301 half hourly
CONSENTTWO0080302 daily
CONSENTTWO0080303 monthly
I know how to recognize the keyword of the header using the regular expressions, which is not like indicating that you read all the lines from the next line to that header until you find the next one.
Greetings.