non so se ho capito bene il tuo problema...
hai provato qualcosa tipo

cat file_vecchio | sort > file_nuovo

ad esempio?

bye