Checking if a file has been sorted

You can check if a file has already been sorted with the -c option. For example:

   sort -c +2 -3 accounts

This checks to see if the file accounts has already been sorted on the third field of each line. You will only get a message if the file is not sorted according to this sequence.

Top document