sed -e 's,[\\/][^\\/][^\\/]*$,,'
Can someone explain the options in this command?
sed -e 's,[\\/][^\\/][^\\/]*$,,'
Can someone explain the options in this command?
It's an implementation of dirname, it strips the characters after the last directory separator from the supplied string(s)
It is done in an architecture neiutral fashion (ie slash or backslash are acceptable path separators)
[\\/] means \ or /
[^\\/] means anything NOT \ or /