[Top][All Lists]

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

Re: bug report : tail

From: Bob Proulx
Subject: Re: bug report : tail
Date: Fri, 17 Nov 2006 10:17:45 -0700
User-agent: Mutt/1.5.9i

Mark McKenzie wrote:
> Using tail from
> Version: 5.97
> of GNU coreutils
> tail +NUM
> no longer works
> tail -n +NUM
> does work

Your observations are accurate.  If you wish to conform to the
previous standard then set _POSIX2_VERSION=199209 in your environment.

Try this:

  env _POSIX2_VERSION=199209 tail +NUM

The NEWS file for GNU coreutils says this on the topic:

** Bring back support for `head -NUM', `tail -NUM', etc. even when
  conforming to POSIX 1003.1-2001.  The following changes apply only
  when conforming to POSIX 1003.1-2001; there is no effect when
  conforming to older POSIX versions.

  The following usages now behave just as when conforming to older POSIX:

    date -I
    expand -TAB1[,TAB2,...]
    fold -WIDTH
    head -NUM
    join -j FIELD
    join -j1 FIELD
    join -j2 FIELD
    join -o FIELD_NAME1 FIELD_NAME2...
    nice -NUM
    od -w
    pr -S
    split -NUM
    tail -[NUM][bcl][f] [FILE]

  The following usages no longer work, due to the above changes:

    date -I TIMESPEC  (use `date -ITIMESPEC' instead)
    od -w WIDTH       (use `od -wWIDTH' instead)
    pr -S STRING      (use `pr -SSTRING' instead)

  A few usages still have behavior that depends on which POSIX standard is
  being conformed to, and portable applications should beware these
  problematic usages.  These include:

    Problematic       Standard-conforming replacement, depending on
       usage            whether you prefer the behavior of:
                      POSIX 1003.2-1992    POSIX 1003.1-2001
    sort +4           sort -k 5            sort ./+4
    tail +4           tail -n +4           tail ./+4
    tail - f          tail f               [see (*) below]
    tail -c 4         tail -c 10 ./4       tail -c4
    touch 12312359 f  touch -t 12312359 f  touch ./12312359 f
    uniq +4           uniq -s 4            uniq ./+4

    (*) "tail - f" does not conform to POSIX 1003.1-2001; to read
    standard input and then "f", use the command "tail -- - f".

  These changes are in response to decisions taken in the January 2005
  Austin Group standardization meeting.  For more details, please see
  "Utility Syntax Guidelines" in the Minutes of the January 2005
  Meeting <http://www.opengroup.org/austin/docs/austin_239.html>.

The info pages say:

  Some older `tail' implementations also support an obsolete option
  `+COUNT' with the same meaning as `-+COUNT'.  POSIX 1003.1-2001
  (*note Standards conformance::) does not allow these options; use
  `-c COUNT' or `-n COUNT' instead.

In the Standards conformance section of the docs:

  The GNU utilities normally conform to the version of POSIX that is
  standard for your system.  To cause them to conform to a different
  version of POSIX, define the `_POSIX2_VERSION' environment variable
  to a value of the form YYYYMM specifying the year and month the
  standard was adopted.  Two values are currently supported for
  `_POSIX2_VERSION': `199209' stands for POSIX 1003.2-1992, and
  `200112' stands for POSIX 1003.1-2001.  For example, if you are
  running older software that assumes an older version of POSIX and
  uses `sort +1', `head -1', or `tail +1', you can work around the
  compatibility problems by setting `_POSIX2_VERSION=199209' in your


reply via email to

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