Sort package names, format, remove duplicate lines.