Why is there a difference between the meaning of NUM in head -c
and tail -c
?
I will clarify what I mean with the following commands:
$ echo "words" | tail -c +1
words
$ echo "words" | tail -c +2
ords
$ echo "words" | head -c -1
words$ echo "words" | head -c -2
word$
The first command does nothing.
The second command removes the first letter.
The third command removes the newline.
The last command removes the last 2 characters including the newline.
So why does head removes 2 bytes when using -c
and tail only one. This looks like some real inconsistency or is there an underlying meaning?