Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 173431 - tail +N syntax broken / missing
Summary: tail +N syntax broken / missing
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
: 203535 203537 217174 229151 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2005-11-17 02:16 UTC by Jason Vas Dias
Modified: 2007-11-30 22:11 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-11-17 09:10:51 UTC

Attachments (Terms of Use)

Description Jason Vas Dias 2005-11-17 02:16:17 UTC
Description of problem:

coreutils-5.93-1's tail no longer responds to the +N argument correctly,
where N is an integer.

In every version of tail I have ever used, on Linux / Solaris / Unix,
'tail +N' means 'cat the file from the Nth line' . 

It means this on FC-4 ( coreutils-5.2.1-48.1 )
$ echo '1
3' > f
$ tail +2 f
$ tail -1 f

But no longer on FC-5 :
$ tail +2 f
tail: cannot open `+1' for reading: No such file or directory
==> f <==

This is most annoying, and will break many scripts that use the '+N' feature -
eg. the dhcdbd-1.9 Makefile, which will now have to use perl instead.
The +N feature is especially useful for use in conjunction with grep -n
to cat lines that follow the first matching line in a file.

Please give us back +N !

Comment 1 Tim Waugh 2005-11-17 09:10:51 UTC
The correct syntax for this is "tail -n +2 f".  You can get the old syntax
(which does not conform to the current POSIX spec) back like this:

export _POSIX2_VERSION=199209
seq 1 3 > f
tail +2 f

See the info page aobut this:

  info coreutils "Standards Conformance"

Comment 2 Tim Waugh 2006-08-23 08:36:04 UTC
*** Bug 203535 has been marked as a duplicate of this bug. ***

Comment 3 Ehringer Eike 2006-08-24 09:43:12 UTC
but then i´am wondering - when the old syntax does not conform the current 
POSIX spec, why the MAN pages says:
If the first character of N (the number of bytes or lines) is a +, print
beginning with the Nth item from the start of each file, otherwise,  print
the  last  N  items in the file.

Would it be possible to get a package with the functionallilty - like the MAN 
pages saing?

Comment 4 Tim Waugh 2006-08-24 10:22:59 UTC
Ehringer: you are mis-interpreting the man page.  Here is what it actually says:

       -n, --lines=N
              output the last N lines, instead of the last 10


       If the first character of N (the number of bytes or lines)  is  a  â+â,

In other words, the N here is the one from --lines=N.  The case described is for
--lines=+1 (for example).

The '-n, --lines=N' syntax is the common way of describing that there is a short
option (-n) and a long option (--lines), both of which take an argument N.  So
this is a short way of saying '-n N, --lines=N'.

Comment 5 Tim Waugh 2006-08-24 10:24:11 UTC
*** Bug 203537 has been marked as a duplicate of this bug. ***

Comment 6 Ehringer Eike 2006-08-24 13:33:00 UTC
Ok thanks!
Sorry for misunderstood...
bye eike

Comment 7 Tim Waugh 2006-11-24 18:39:01 UTC
*** Bug 217174 has been marked as a duplicate of this bug. ***

Comment 8 Tim Waugh 2007-02-19 09:37:02 UTC
*** Bug 229151 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.