[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19533: comm does not detect common lines -- Mac OS X 10.9.5
From: |
Bob Proulx |
Subject: |
bug#19533: comm does not detect common lines -- Mac OS X 10.9.5 |
Date: |
Wed, 7 Jan 2015 15:59:18 -0700 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Eric Blake wrote:
> Ali Khanafer wrote:
> > I tried comm on test1.txt and test2.txt. The output I got is in
> > comm-test.txt. Comm found 11 common lines and missed 6 other lines.
> >
> > Could you please explain why this is happening?
>
> Using a newer version of coreutils would tell you why:
> ...
> Proper use of comm requires that you pre-sort both input files. As
> such, this is not a bug in comm, so I'm closing this bug. However, feel
> free to add further comments or questions.
If you are using bash then a bash specific feature is useful. You can
sort them on the fly.
comm <(sort test1) <(sort test2)
Or perhaps forcing a sort locale.
env LC_ALL=C comm <(sort test1) <(sort test2)
I included LC_ALL=C to force a specific sort order which may or may
not be appropriate for all of your use cases.
Bob