[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Did the options for the Unix sort command change?
From: |
Eric Blake |
Subject: |
Re: Did the options for the Unix sort command change? |
Date: |
Thu, 14 Aug 2008 18:59:55 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Michael Alston on 8/14/2008 6:42 PM:
> Question:
>
> Did the options for the Unix sort command change?
No. GNU sort has never accepted a digit as an option, nor does POSIX
require it:
http://www.opengroup.org/onlinepubs/009695399/utilities/sort.html
However, I have no idea if you were used to another implementation of sort
that might have provided -<digit> as an extension, probably short for
- -k<digit>.
>
> Why does:
>
> % sort -5 myfile
>
> no longer sort myfile by keying off of column 5?
Column 5 or field 5? On the assumption that you might have mistyped:
% sort -k5 myfile
then this behavior is most likely a misunderstanding on your part. That
particular command means to sort using the fifth and subsequent fields as
the sort key. Finally, if you want to sort by the fifth field only, then
you would use:
% sort -k5,5 myfile
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEUEARECAAYFAkik1QsACgkQ84KuGfSFAYDR5wCfSm2U+ddKuTvqZRsm5reDhZsk
/gEAmMU4bI/ybLA5rnk8R04/REzqb14=
=W3mz
-----END PGP SIGNATURE-----