I have a directory name in a string and I need to extract all except the last 2 subdirectories. For example:
I need to get:
The number of levels of the directory is variable, but I always need to chop off the last two subdirectories from the string.
I would like to do this in a single command.