bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reg. 'sort' problem in Mac OS X


From: Eric Blake
Subject: Re: Reg. 'sort' problem in Mac OS X
Date: Thu, 30 Aug 2007 20:32:44 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Mallika Veeramalai on 8/30/2007 6:17 PM:
> The command 'sort -g -k 1 t.txt' gives the following result.
> 
> 1.46e-13 H
> 1.53e-11 H
> 1.54e-03 H

Although it didn't seem like this was your question, I think you should
beware the difference between '-k1,1' and '-k1'.  As typed in your
example, the sort key is the entire line, rather than just the first field.

> 
> I think this 'sort' problem exist in every where, even when we use the
> 'ls -trl' to list the file in a dir - mainly because many sort options not
> included in the Mac OS X 10.4.10 version.

I'm not quite sure what question you are asking, so here's the question I
will answer: "Why doesn't the sort provided natively with MacOS X 10.4.10
provide the -g option?"

In which case, the answer is, this is the wrong list to ask the question
on.  'sort -g' is a GNU extension, provided by GNU coreutils, but not
required by standards bodies.  Therefore, if MacOS ships with their own
sort, rather than the GNU coreutils version, then they don't have to
support -g; and if you want it to support -g, you should ask on a MacOS
support forum.

Fortunately, there is no law that says you can't also install GNU
coreutils on a MacOS X 10.4.10 system, and put its location first in your
PATH, in order to choose the GNU sort instead of the Mac native sort.  But
keep in mind that using GNU extensions in scripts means your scripts are
no longer portable to non-GNU systems, as you discovered.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG133M84KuGfSFAYARAiAgAJ9W3qQMYQ+XVO6Em8/C4SURSNfsrwCdHAtn
pj0iNxJ7Bcp0OV7NOiHn1yE=
=XYLn
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]