Hello,
I can implement for you a Fortran program that will take as input a file that contains an unordered matrix (as per the attached document). The Fortran code will sort the matrix per rows, after which it will sort the rows. We can discuss the details if you are interested to work with me.
Thanks and looking forward to work with you,
Paul