in reply to parse file per customized separator / block / metadata

Not sure I understand entirely. Could you elaborate on the details, i.e. is there some constant record separator between the multi-line parts you want to extract? Where does the to-be-customized separator occur; is it just the thing between header and val — in which case you could possibly find a regex that handles all cases in one go while matching against the records.  A few more lines of sample input, and some sample search commands might help.