bug-coreutils
[Top][All Lists]
Advanced

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

Re: sort -u -n error : sort v 4.5.3


From: Andreas Schwab
Subject: Re: sort -u -n error : sort v 4.5.3
Date: Sun, 05 Mar 2006 03:51:15 +0100
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux)

Will Smith <address@hidden> writes:

> Sort : the -u (unique) and  -n (numeric) options seem to clash, removing too 
> many lines.
>
>
> address@hidden data]# cat /tmp/new_spammers
> 64.202.165.132
> 64.202.165.131
> 64.202.165.133
[...]
> address@hidden data]# sort -u -n < /tmp/new_spammers
> 64.202.165.132

Not a bug: all three lines have the same sort key, namely the number
64.202, the rest of the sort field is ignored.  You probably want to split
the line on the period and treat each whole number as a separate sort key:

$ sort -t. -u -n -k1,1 -k2,2 -k3,3 -k4,4 < /tmp/new_spammers

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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