9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Richard Miller <9fans@hamnavoe.com>
To: 9fans@9fans.net
Subject: Re: [9fans] sort strangeness
Date: Sun, 27 Sep 2009 10:10:53 +0100	[thread overview]
Message-ID: <5dbb79ad844dc05439e260be7dead23b@hamnavoe.com> (raw)
In-Reply-To: <1cd6434aef47eeafe99955082c22eb55@comcast.net>

You probably want it to look at the rest of the line after sorting
according to the initial numeric string, like this:

cpu% cat tmp/sorttest
2
7
2.1
2.1.4
2.1.1
term% sort +0n +1 -t. -u tmp/sorttest
2
2.1
2.1.1
2.1.4
7

I think the "strangeness" you observed is consistent with what
the man page says:

          -n   An initial numeric string, consisting of optional white
               space, optional plus or minus sign, and zero or more
               digits with optional decimal point, is sorted by arith-
               metic value.
          -u         Suppress all but one in each set of equal lines.
                     Ignored bytes and bytes outside keys do not par-
                     ticipate in this comparison.




      parent reply	other threads:[~2009-09-27  9:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-27  7:54 Gregory Pavelcak
2009-09-27  9:02 ` Tharaneedharan Vilwanathan
2009-09-27 13:42   ` Gregory Pavelcak
2009-09-27  9:10 ` Richard Miller [this message]

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=5dbb79ad844dc05439e260be7dead23b@hamnavoe.com \
    --to=9fans@hamnavoe.com \
    --cc=9fans@9fans.net \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).