How to remove new line character at end of file.

 
sed '$d' file
 
Test environment  centos 5.5