get everything before the last / shell code example
Example: get everything before the last / shell
echo "/home/me/documents/morestuff/before_last/last" | sed s:/[^/]*$::
echo "/home/me/documents/morestuff/before_last/last" | sed s:/[^/]*$::