NetBSD-Users archive

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

sort weirdness



[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

I would expect the output to be:

192 27 4 18 blah
192 27 10 4 blahhh
192 168 10 4 blahh

because of the flags chosen [sorting numerically, using a space as field delimiter, consider the first 4 fields as sort criteria]. Is my thinking wrong? If so, can somebody correct my thinking? :)


--
Ron McDowell
San Antonio TX



Home | Main Index | Thread Index | Old Index