general framework to parse flat data files into a structured output