sort overlapping input files