I was trying using head
command, in macOS using zsh, code below,
a.txt:
1
2
3
4
5
6
7
8
9
10
tail -n +5 a.txt // line 5 to line end
tail -n -5 a.txt // last line 5 to line end
head -n +5 a.txt // line 1 to line 5
head -n -5 a.txt // # What did this do?
The last command shows an error.
head: illegal line count -- -5
What did head -n -5 actually do?
Some implementations of head
like GNU head
support negative arguments for -n
But that's not standard! Your case is clearly not supported.
When supported The negative argument should remove the last 5 lines
before doing the head