|
If including the last directory component as well is acceptable then you can do [^/]*/[^/]*$ to get the last and the penultimate directory (#1 and half #2) and then if you trim #1 and the last slash, you get the real answer for #2.
*? is certainly not a plain old grep regular expression.
What's the point of this exercise?
|