Flat file sorting/grouping

If the file (and it’s processing) fits into memory I would use an XSLT service, as XSLT provides grouping of elements. XSLT is also a good alternative if you have greater changes in the structure which are difficult to implement using map steps like movmeent of nodes in the document hierarchy, changes of grouoings etc.