delete the last line

i want to delete the last line in file

example:

filename:xyz

1
2
3
4

i want to delete the lastline(4) in the xyz file.please give the command for delete the last line in a file

thanks

Multiple ways to do it.

sed -e '$d' input.file > output.file

One more way

Using ex:

head -$((`wc -l file | awk '{print $1}'` - 1)) file

or

sed -n '$!p' file