Bug 173431 - tail +N syntax broken / missing
Summary: tail +N syntax broken / missing
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
URL:
Whiteboard:
: 203535 203537 217174 229151 (view as bug list)
Depends On:
Blocks:
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:
Environment:
Last Closed: 2005-11-17 09:10:51 UTC
Type: ---
Embargoed:


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
2
3' > f
$ tail +2 f
2
3
$ tail -1 f
3

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

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
Hi,
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.