Bash: how not to print first or last N lines of a file

Bash: how not to print first or last N lines of a file

Assume we have the following file named file.txt

aaa 
bbb 
ccc 
ddd 
eee 
fff 
ggg 
hhh 
iii 
kkk 
lll 
mmm 
nnn

Not to print the last 3 lines use the head command with a negative integer number as input

cat file.txt | head -n -3 
aaa 
bbb 
ccc 
ddd 
eee 
fff 
ggg 
hhh 
iii 
kkk

Not to print the first 3 lines use the tail command like this, with the plus symbol

cat a.txt | head -n -3 | tail -n +4 
ddd 
eee 
fff 
ggg 
hhh 
iii 
kkk

Easy right? :) i hope you liked those super simple and sort examples, see you next time!

$ ./buy-me-a-coffee ☕ // found this useful? I write these in my spare time