To replace the last /in a file name with : I tried following code.
set x a/b/c
regsub {.*(\/)\S+$} $x {:}
The undesired result is :.
The desired result is a/b:c
Examples:
a -> a
a/b -> a:b
aa/b -> aa:b
aa/bb/.../dd/e -> aa/bb/.../dd:e
Feedback is appreciated.
With a regular expression, you can say
Or, use the
filecommandThe problem with the 2nd option is if the string does not contain a slash, you get
a=>.:aso you need to do something like this: