This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 173431 - tail +N syntax broken / missing
tail +N syntax broken / missing
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
:
: 203535 203537 217174 229151 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-16 21:16 EST by Jason Vas Dias
Modified: 2007-11-30 17:11 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-11-17 04:10:51 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jason Vas Dias 2005-11-16 21:16:17 EST
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 04:10:51 EST
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 04:36:04 EDT
*** Bug 203535 has been marked as a duplicate of this bug. ***
Comment 3 Ehringer Eike 2006-08-24 05:43:12 EDT
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 06:22:59 EDT
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 06:24:11 EDT
*** Bug 203537 has been marked as a duplicate of this bug. ***
Comment 6 Ehringer Eike 2006-08-24 09:33:00 EDT
Ok thanks!
Sorry for misunderstood...
#
bye eike
Comment 7 Tim Waugh 2006-11-24 13:39:01 EST
*** Bug 217174 has been marked as a duplicate of this bug. ***
Comment 8 Tim Waugh 2007-02-19 04:37:02 EST
*** 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.