GNU bug report logs - #6605
+N lines broken with /usr/bin/tail (GNU coreutils) 7.4

Previous Next

Package: coreutils;

Reported by: Forest Oakwater <forest_oakwater <at> yahoo.com>

Date: Sat, 10 Jul 2010 16:30:04 UTC

Severity: normal

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Forest Oakwater <forest_oakwater <at> yahoo.com>
Cc: bug-coreutils <at> gnu.org
Subject: Re: bug#6605: +N lines broken with /usr/bin/tail (GNU coreutils) 7.4
Date: Thu, 15 Jul 2010 15:15:08 -0600
Forest Oakwater wrote:
> Thank you for the information.  Would you consider updating the
> builtin documentation and man page to match the behavior of the
> program?

You say that like it doesn't match now.  :-)  But it does.  You even
quoted the important parts in your original message.

You wrote:
>  -n, --lines=N            output the last N lines, instead of the last 10;
>                           or use +N to output lines starting with the Nth

So I know you have an older version of the program with the older
version of the online docs.  But those are strictly correct!  The
confusion you are experiencing comes from the -n using 'n' and the
--lines=N using 'N'.  Some time in the last while there was another
discussion of this (it will be in the archive but I don't have time to
look) we decided to change this to K to make it more obvious.  The
current online documentation says:

    -n, --lines=K            output the last K lines, instead of the last 10;
                             or use -n +K to output lines starting with the Kth
  If the first character of K (the number of bytes or lines) is a `+',

We thought it was more clear to use 'K' instead to avoid any confusion
of N with -n.  But as you can see with K it still says about the same
thing.  If you want to use a +NUM then you need to say 'tail -n +2' or
some such.  So the older documentation is correct and the newer
documentation is both correct and more helpful.

> Also, do you know of an efficient POSIX way to filter out the first
> N lines of a text file?

I personally like sed for this.

  sed 1,2d FILE

Or:

  sed -n '3,$p' FILE

> # inefficient?
> head -N datafile > datafile.head
> diff datafile.head datafile |grep '^>' |cut -c3- > datafile.new
> mv datafile.new datafile

Please, my eyes, the pain! :-}

Bob




This bug report was last modified 13 years and 307 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.