Sorted file

Hi

Is there any unix shell command or utility to know if the file is sorted or not?

Thanks

None that I am aware of.

man sort :wink:

e.g.

#  cat infile
a
b
d
c
f
e
#  sort -c infile
sort: disorder: c

#  cat  infile
a
b
d
e

#  sort -c infile

i.e. if not sorted will tell you.  if sorted will exit with no errors.

HTH

Yah... thnxs.. exactly i'm looking out for this simple command..