trimming a file...

Hi everyone
I have this script that appends a line to a file to log the running status of an application. I need to write another script to run as a scheduled job in cron to trim the first x number of lines of this file.

Could someone give me an idea how to do this?


head -x file > /tmp/file
mv /tmp/file file

Replace x with the number of lines you wish to keep. This will keep lines from the top. If you wish to keep lines counting from the bottom, replace head with tail.