corrected the sort specification for output lines and filename groupings