bug-coreutils
[Top][All Lists]
Advanced

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

Re: Mac OS10 bug


From: Alfred M. Szmidt
Subject: Re: Mac OS10 bug
Date: Mon, 13 Apr 2009 04:36:30 -0400

   say I want to sort on column 3, numericaly, reversed order:

   sort -nu +2 -3 file > files

>From the Coreutils documentation, (coreutils) sort invocation:

|    On older systems, `sort' supports an obsolete origin-zero syntax
| `+POS1 [-POS2]' for specifying sort keys.  This obsolete behavior can
| be enabled or disabled with the `_POSIX2_VERSION' environment variable
| (*note Standards conformance::); it can also be enabled when
| `POSIXLY_CORRECT' is not set by using the obsolete syntax with `-POS2'
| present.

Also, 

| `-k POS1[,POS2]'
| `--key=POS1[,POS2]'
|      Specify a sort field that consists of the part of the line between
|      POS1 and POS2 (or the end of the line, if POS2 is omitted),
|      _inclusive_.
| 
|      Each POS has the form `F[.C][OPTS]', where F is the number of the
|      field to use, and C is the number of the first character from the
|      beginning of the field.  Fields and character positions are
|      numbered starting with 1; a character position of zero in POS2
|      indicates the field's last character.  If `.C' is omitted from
|      POS1, it defaults to 1 (the beginning of the field); if omitted
|      from POS2, it defaults to 0 (the end of the field).  OPTS are
|      ordering options, allowing individual keys to be sorted according
|      to different rules; see below for details.  Keys can span multiple
|      fields.
|
|      Example:  To sort on the second field, use `--key=2,2' (`-k 2,2').
|      See below for more examples.

Thus, sort -nurk 3,3 file





reply via email to

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