SED: Removing Filenames From Paths

I'm using a script with a lot of SED commands, in conjunction with grep, cut, etc. I've come up against a wall with a particular road block:

I output a file from an SVN registry that gives me a list of files. The list consists of a variable number of lines that contain a path/file. The paths are not a consistent length, hence a variable number of /'s in them. I pipe this output to a file and manipulate that file to create a list of source files for a copy routine I'm writing.

I'd like to be able to read the path line(s) from this file and remove the file name itself thus replicating just the path that I can feed to an rcp command. But I've been hitting a wall as to how to detect the last slash in the line.

from

/u/dir1/dir2/dir3/file
/u/dir1/dir2/file
/u/dir1/file

to

/u/dir1/dir2/dir3/.
/u/dir1/dir2/.
/u/dir1/.

Or blank instead of periods.

I can show you my work / first tries if need be, but it resides in a lab that is cut off from public access, ie: the internet, so I'd have to retype it and thus, why I don't have my first examples here to look at.

Any sort of help would be appreciated, whether it be pointing me to another link (I've been searching this site for quite some time) I haven't found yet or what not.

Thanks folks! -Bruce

The unix command "dirname" does this.

Or without an external command:

filename="/u/dir1/dir2/dir3/file"
dirname=${filename%/*}

Thank you guys... just the pointers I needed to create my new list. If I had money, I'd send you guys a pittance.... since I don't a hearty thanks is all I have for you!

Thanks for taking the time to chime in!

see using SED we can replace the filename in path.

sed 's%/[A-z]*$%/.%g' path

Input:
/u/dir1/dir2/dir3/file
/u/dir1/dir2/file
/u/dir1/file

Output:
/u/dir1/dir2/dir3/.
/u/dir1/dir2/.
/u/dir1/.