Eric: So it is not a bug? When I use sort -n -k2.1,2.19, it sorts accordingly.
Thanks. Have a nice day, Sheila Yao -----Original Message----- From: Andreas Schwab [mailto:sch...@linux-m68k.org] Sent: Tuesday, January 19, 2010 11:23 AM To: Sheila Yao Cc: Eric Blake; bug-coreutils@gnu.org Subject: Re: different behavior of sort Sheila Yao <s...@secureworks.com> writes: > sort -n -k2.1,2.4 /tmp/sort.out > /dev/emcpowera 47G 39G 7.8G 84% /DB1/DW/data9 ^^^^ The sort key is probably not what you think it is. I have marked it for you. Since the sort key is identical in all lines, sort has used as a last resort the whole line as the sort key. >From sort --help: POS is F[.C][OPTS], where F is the field number and C the character position in the field; both are origin 1. If neither -t nor -b is in effect, characters in a field are counted from the beginning of the preceding whitespace. You should probably just use the whole second field as the sort key. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."