in reply to Filtering text file made into hash

Did your instructor tell you what the correct results should be? Your description and your example data are ambiguous (as others have already said).

Dum Spiro Spero