I am learning awk/gawk. So recently I just try to solve any problem with it to gain more practice opportunities.
My coworker asked a question yesterday,
Let me suggest another solution. In case if you need custom N for top and bottom lines you can use tail and head commands:
awk '{print $1}' | head -n -1 | tail -n+2
head -n -1 - removes last line
tail -n+2 - starts output from second line (removes 1 line)
Following command will remove 3 lines from top and bottom:
awk '{print $1}' | head -n -3 | tail -n +4
Actually we don't even need awk here:
more | head -n -1 | tail -n +2
or
cat | head -n -1 | tail -n +2
Thanks to Igor Fobia for comment!