NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: sort weirdness
On Tue, Oct 04, 2011 at 02:26:29PM -0500, Ron McDowell wrote:
> [rcm@nbsd(NetBSD)]> uname -a
> NetBSD nbsd.fuzzwad.net 5.1 NetBSD 5.1 (GENERIC) #0: Sat Nov 6 13:19:33
> UTC 2010
> builds%b6.netbsd.org@localhost:/home/builds/ab/netbsd-5-1-RELEASE/amd64/201011061943Z-obj/home/builds/ab/netbsd-5-1-RELEASE/src/sys/arch/amd64/compile/GENERIC
>
> amd64
>
> [rcm@nbsd(NetBSD)]> cat file # there is a single space between "words"
> 192 168 10 4 blahh
> 192 27 10 4 blahhh
> 192 27 4 18 blah
>
>
> [rcm@nbsd(NetBSD)]> sort -n -t' ' -k1,4 file
>
> 192 168 10 4 blahh
> 192 27 10 4 blahhh
> 192 27 4 18 blah
>
-k1,4 specifies 1 to 4 as _one_ field. You must use:
sort -n -t' ' -k1 -k2 -k3 -k4 file
HTH
--
Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C
Home |
Main Index |
Thread Index |
Old Index