[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Possible bug in 'sort -m'



On 13.03.07 15:34, Bob McGowan wrote:
>   sort -n -o from_number from_number
> 
>   sort -n -o to_number to_number
[deleted]
>   sort -m from_number to_number | uniq | wc -l
>   122010
> 
> This is still almost 12000 too big (only 17 less than the 'uniq' on the 
> separate files).  So, I run this:
> 
>   sort -u from_number to_number | wc -l
> 
> And I get 110256, the same number as the SQL UNION gave me.
> 
> So, if both files are sorted and I then use 'sort -m' followed by 'uniq' 
> and count the results, shouldn't I get the same thing as resorting the 
> two (already sorted) files with sort's '-u' option and counting that output?

Either do not sort those files numerically, or _always_ use '-n' with sort.
The latter may work, the first should work.

> I did wonder if I needed to use '-n' with the '-m', but that didn't fix 
> anything, in fact, I got a different count:  121995.
> 
> Am I missing something obvious, having to do with numbers and merging? 
> Or is this a bug in sort?

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
I intend to live forever - so far so good. 



Reply to: