fsort -- Sort the contents of a FITS table
fsort filename[ext#] column
This task sorts the rows in a FITS table based on the values in a specified column of the table. The table is sorted in place, so as a precaution one should always save a copy of the table before running this task. Aborting this task once it has started can leave the FITS table in a corrupted state. The table may be sorted in ascending or descending order, and multi-column sorting may also be performed. The later means that once the rows have been sorted on the value of the first column, then all identical values in the first column will be sorted in order of the second specified column, and so on.
1. Sort the time column found in the second table extension in ascending order in the FITS file test.fits
ft> fsort test.fits[2] time
2. Sort using the X and then the Y columns found in the first extension in descending order in the FITS file test.fits, deleting duplicate rows containing the same values of X and Y.
ft> fsort test.fits "X Y" ascend=no unique=yes
ftsort, fv, the interactive FITS file editor, can also be used to sort a FITS table.