0 or 1 match is ?Eg. echo /aaa/.bbb//ccc/123 | sed 's,\(/\.\?[^/]\)[^/]*,\1,g'
--William
Nice - that works too.
Jeez regex is a pain - it took three minutes of staring at that just to figure it out, even though I knew what we were both trying to achieve.