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

From: Michael Speer <[email-masked]>
Date: Fri, 6 Mar 2020 12:32:04 -0500

you want the `head` of the file sans the last few lines, rather than the
`tail` of the file sans the first few.

from the man page for tail

>      -n, --lines=[+]NUM
>              output the last NUM lines, instead of the last 10; or use -n
+NUM to output starting with line NUM

> use -n +NUM to output starting with line NUM

so content after the given number of lines

from the man page for head

>       -n, --lines=[-]NUM
>              print the first NUM lines instead of the first 10; with the
leading '-', print all but the last NUM lines of each file

> with the leading '-', print all but the last NUM lines of each file

this is the one you want.

the functionality can seem a little backwards, but makes sense if you
consider tail giving data relative to the end and head relative to the
start.
each then has an option to act relative to the other side of the document.

On Fri, Mar 6, 2020 at 10:31 AM Dimitris Moraitidis <
[email-masked]> 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 :)
>
> --
> // Moraitidis D. Dimitris,
> // Athens University of Economics and Business (AUEB)
> // Department of Informatics
>