bug-coreutils
[Top][All Lists]
Advanced

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

bug#39951: tail -n +NUM is not working properly


From: Bernhard Voelker
Subject: bug#39951: tail -n +NUM is not working properly
Date: Fri, 6 Mar 2020 18:35:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 3/6/20 10:42 AM, Dimitris Moraitidis wrote:
Hey there,

tail -n + NUM does not return the desired output. +NUM starts from the top
of the file, not from the bottom.

So for example, given the following file:

this
is
an
example
file
each
word
represents
a
line

and executing tail -n +3 example, I am getting

example
file
each
word
represents
a
line

instead of


this
is
an
example
file
each
word

I am using *tail (GNU coreutils) 8.28 *in latest ubuntu 18.04 LTS

Thanks in advance for looking into this :)

Isn't this exactly what tail(1) is support to do when the user explicitly
passes the '+' sign to the number?

  $ tail --help | grep -A1 -- --lines
    -n, --lines=[+]NUM       output the last NUM lines, instead of the last 10;
                               or use -n +NUM to output starting with line NUM

Also POSIX says so:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/tail.html

Have a nice day,
Berny





reply via email to

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