delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS |
X-Spam-Check-By: | sourceware.org |
X-IronPortListener: | Outbound_SMTP |
From: | "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder AT niaid DOT nih DOT gov> |
To: | "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> |
Date: | Wed, 31 Dec 2008 16:29:36 -0500 |
Subject: | Inconsistency with sort -n? |
Message-ID: | <0105D5C1E0353146B1B222348B0411A211B41DEC@NIHMLBX02.nih.gov> |
MIME-Version: | 1.0 |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id mBVLd5tU021882 |
`sort -n' and `sort -g' work inconsistently with 0 and -0 if there are leading spaces. Sometimes -0 is before 0, as I would expect, and sometimes it is afterwards. Adding `-b' does not seem to help. Is this where I should report it or should I go upstream? In case you are wondering why I want to do this: I'm counting items in a bin so the bin from -1 to 0 and 0 to +1 are different. Please excuse the excessive number of examples. Happy Gregorian New Year! - Barry Disclaimer: Statements made herein are not made on behalf of NIAID. ________________ $ echo 0 -1 -0 1 | tr ' ' '\n' | sort -n -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e 's/^/ /' | sort -n -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/s/^/ /' | sort -n -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/^.$/s/^/ /' | sort -n -1 0 -0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/s/^/ /' -e 's/^/ /' | sort -n -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/^.$/s/^/ /' -e 's/^/ /' | sort -n -1 0 -0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/s/^/ /' -e 's/^/ /' | sort -n -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/!s/^/ /' -e 's/^/ /' | sort -n -1 0 -0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sort -g -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e 's/^/ /' | sort -g -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/s/^/ /' | sort -g -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/^.$/s/^/ /' | sort -g -1 0 -0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/s/^/ /' -e 's/^/ /' | sort -g -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/^.$/s/^/ /' -e 's/^/ /' | sort -g -1 0 -0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/s/^/ /' -e 's/^/ /' | sort -g -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/!s/^/ /' -e 's/^/ /' | sort -g -1 0 -0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sort -nb -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e 's/^/ /' | sort -nb -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/s/^/ /' | sort -nb -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/^.$/s/^/ /' | sort -nb -1 0 -0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/s/^/ /' -e 's/^/ /' | sort -nb -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/^.$/s/^/ /' -e 's/^/ /' | sort -nb -1 0 -0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/s/^/ /' -e 's/^/ /' | sort -nb -1 -0 0 1 $ echo 0 -1 -0 1 | tr ' ' '\n' | sed -e '/-/!s/^/ /' -e 's/^/ /' | sort -nb -1 0 -0 1 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |