Remove header(first line) and trailer(last line) in ANY given file

Hi,

I need some help in removing the header (first line) and the trailer (last line) in a give file...

The data file actually comes in EBCDIC format and I converted it into ASCII..
Now I need to strip off the first line and the last line..

I think we can use sed to do something like this:

sed -n -e '2,964p' InPutFile.dat > OutPutFile.dat

Since I know the file has 965 rows, I could do this...But I would like to automate this script..

Thank you,
Madhu

Try:
sed '1d;$d'

Thank you for the message. I was just wondering if we can do the same thing on EBCDIC data file which is fixed width. Can we remove the lines depending on the number of bytes in an EBCDIC file? Like remove 23 bytes in the beginning and 8 bytes at the end...

Thanks again,
Madhu