bug-coreutils
[Top][All Lists]
Advanced

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

Re: sort -u produces incorrect output


From: Eric Blake
Subject: Re: sort -u produces incorrect output
Date: Fri, 25 Aug 2006 03:21:24 +0000

> # sort -u -k1 -s x.x
> one one
> two one
> two two
> #
> 
> Quoth POSIX: "-u   Unique: suppress all but one in each set of lines
> having **EQUAL KEYS**." [Emphasis added]
> http://www.opengroup.org/onlinepubs/000095399/utilities/sort.html This
> matches the info text provided by SuSE, while the Debian documentation
> is more vague.

Read further on the same page you already quoted.
"A missing field_end shall mean the last character of the line."
Therefore, your key consists of the entire line, and sort is doing
exactly what you told it to do.

Perhaps you meant:
# sort -u -k1,1 -s x.x

to limit the key to just the first field?

-- 
Eric Blake




reply via email to

[Prev in Thread] Current Thread [Next in Thread]