I have some code that, afaik, does what you want - however, I ain't posting it until I see some sort of coding effort from you - specifically:
- Some attempt to read both files
- Some attempt to perform a regex to recognise your headers and objects
- Some attempt to sum the final object field where appropriate
Your code needn't work or, indeed, even run, but it should demonstrate good faith on your part...
Tom Melly, firstname.lastname@example.org