From: Aleksey Novodvorsky <aen@logic.ru>
To: mandrake-russian@altlinux.ru
Subject: Re: [mdk-re] `sort` behaves not as expected (not as strcmp() would)
Date: Mon Oct 1 16:14:14 2001
Message-ID: <3BB86008.678BAF7B@logic.ru> (raw)
In-Reply-To: <20011001154744.B11095@hb.ant-on.net>
HB wrote:
> Я столкнулся с тем, что не понимаю, как сортирует sort, и как заставить
> его сортировать так, как это сделал бы strcmp(). Разумеется, я читал
> `man sort`, но это не только не помогло, но создало впечатление, что
> работа sort происходит не так, как там описано :-(
>
> $ cat file
> a
> *b
> *d
> c
> $ sort file
> a
> *b
> c
> *d
>
> Похоже на то, что при сортировке игнорируются все non-alphanumeric (?)
> символы. Кусок из `man sort`, говорящий (AFAI understood) об обратном,
> прилагается ниже.
>
> А хотелось бы получить такую сортировку:
>
> $ perl -we 'print sort <>' file
> *b
> *d
> a
> c
>
> /* Разумеется, использовать для этого Perl -- это не метод. */
> Выдержка из `man sort`:
>
> Finally, as a last resort when all keys compare equal (or
> if no ordering options were specified at all), sort com-
> pares the lines byte by byte in machine collating sequence
> instead of LC_COLLATE.
>
Пользуйтесь info, man всегда старее.
Не помню уж с какой версии, но относительно недавно sort стал учитывать
LC_COLLATE.
$ LC_COLLATE=C sort file
спасет.
Rgrds, AEN
next prev parent reply other threads:[~2001-10-01 16:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-01 15:49 HB
2001-10-01 16:14 ` Aleksey Novodvorsky [this message]
2001-10-01 17:56 ` HB
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3BB86008.678BAF7B@logic.ru \
--to=aen@logic.ru \
--cc=mandrake-russian@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git