comm to compare two sorted files.
Each line in these files are positive integer numbers.
But the results show
comm: file 1 is not in sorted order comm: file 2 is not in sorted order
How come the error even if these two files are sorted?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
comm requires lexicographic sort (plain
sort), not numeric sort (
sort -n). For example, it wants the following order:
1 2000 300
Not the following order:
1 300 2000
Correct this and the problem should go away. For more esoteric cases where
comm's locale may be different than the
sort locale, you may want to run
LC_COLLATE=C in their environment to use native byte ordering.