Thanks for the report.
This is the way sort is required to work according to POSIX.
Without a -t option, it must include any leading white space
in the field to be sorted.  With a -t-specified separator,
the separator character is ignored.  The behavior without -t
is very non-intuitive and deserves a big warning in the manual --
I'll add something.  One common way to work around that is to
use the -b option or the `b' modifier (see info docs for examples).

  $ echo -e "g a2\ng b1" | sort -b -k 2.2
  g b1
  g a2

Yasuhiro Take <[EMAIL PROTECTED]> wrote:
| [ Give me Cc to every reply. Thanks. ]
|
| Hello, there.
|
| I've met strange behavior of sort when i set the field and the character
| potision to 2 or more, by using -k option.
|
| $ echo -e "a2\nb1" | sort -k 1.2
| b1
| a2
|
| This is correct behavior, but
|
| $ echo -e "g a2\ng b1" | dort -k 2.2
| g a2
| g b1

_______________________________________________
Bug-textutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-textutils

Reply via email to