Variants of this question have certainly been asked several times in different places, but I am trying to remove the last M lines from a file without luck.
The second most voted answer in this question recommends doing the following to get rid of the last line in a file:
head -n -1 foo.txt > temp.txt
However, when I try that in OSX & Zsh, I get:
head: illegal line count -- -1
Why is that? How can I remove the M last lines and the first N lines of a given file?