How to delete the last word in a file?

Hi All,
I have a file with the data as below. In this i want to delete the last word. Could you pls help me.

$INSTALL_HOME/lib/fm_voucher_pol.so
$INSTALL_HOME/source/sys/fm_apn_pol/fm_apn_pol_device_set_state.c

In the above two lines i want to delete fm_voucher_pol.so and fm_apn_pol_device_set_state.c

PS: The field postion of the last word is not known, it may differ line to line.

Thanks in advance,
Giri

One in sed:

$ sed "s/[^/]*$//" file1
$INSTALL_HOME/lib/
$INSTALL_HOME/source/sys/fm_apn_pol/

Try this (backup the file first):

perl -pi -e "s/\/[^\/]+$/\/\n/" file

use "dirname"....

dirname $INSTALL_HOME/lib/fm_voucher_pol.so
result: $INSTALL_HOME/lib

dirname $INSTALL_HOME/source/sys/fm_apn_pol/fm_apn_pol_device_set_state.c
result: $INSTALL_HOME/source/sys/fm_apn_pol

Thanks a lot Guys, it worked!!!....

str=$INSTALL_HOME/lib/fm_voucher_pol.so
echo ${str%/*}