By the way the solution will be implemented in a script which will run on multiple different machines, so the paths will always be different and not static.
Thank you very much for the quick answer. It worked like a charm.
Edit: both suggestions work, I will see which I will use when doing the deep tests.
Edit2: Yes, I know about the grep, but I cannot use grep in my script logic. The directories get extracted via lsof or pfiles.
Please help me out - why can't you use grep when you can use sed to process commands' output? Did you consider shell's "parameter expansion / suffix removal"?