[...]
If you're allowed to sort them, then do that, and do "comm"
on those two.
(It's *exactly* what comm was designed for.)
David
PS: Question: does the following conjecture make any sense?:
Oh, by the way, make you sort via the same scheme that comm uses,
otherwise comm won't think it's sorted. Ie, beware of -u, -r, etc.
Conjecture?
No, the remark doesn't make sense. All comm requires is that identical
lines be next to each other.
The only way you can ensure that identical lines are next to each other by
sorting the separate files is if the files are identical in the first
place. If you already know that, then you are already done.
In the non-trivial case, comm needs a way to re-align the files once it
encounters a non-indentical lines. In order to do that, the sort order
of the files needs to be done the same way that comm expects.
My comm man page doesn't even specify the sort to be ascending or
descending, though it does (unnecessarily) specify "lexically".
Apparently man wasn't good enough, now if you want to know how a
commandline tool works you have read the "info" page too.
from info comm:<<EOF
Before `comm' can be used, the input files must be sorted using the
collating sequence specified by the `LC_COLLATE' locale. If an input
file ends in a non-newline character, a newline is silently appended.
The `sort' command with no options always outputs a file that is
suitable input to `comm'.
EOF
Xho