http://www.perlmonks.org?node_id=1086269


in reply to Deleting first and last TWO(2) lines of a text file

perl -i.old -ne 'print unless $.==1 or eof' <input-file>
This will also keep the old version around as <input.file>.old