[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sort] strange behavior.
From: |
Jim Meyering |
Subject: |
Re: [sort] strange behavior. |
Date: |
03 Jan 2001 12:51:49 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.95 |
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 <address@hidden> 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