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,
This does the trick:
awk 'NR>2 {print last} {last=$0}'
awk executes the action print last only when NR > 2 (that is, on all lines but the first 2). On all lines, it sets the variable last to the current line. So when awk reads the third line, it prints line 2 (which was stored in last). When it reads the last line (line n) it prints the content of line n-1. The net effect is that lines 2 through n-1 are printed.