Problem:
echo 'diff a/package/myname:/src/com/abc' | sed -e 's/\<\/package\/myname\:\>//g'
^ ^
| |
problem is mainly because of the two word boundaries.
\< - Boundary which matches between a non-word character and a word character.
\> - Boundary which matches between a word character and a word character and a non-word character.
So in the first case,
echo 'diff a/package/myname:/src/com/abc' | sed -e 's/\<package\/myname\>//g'
The \< before the package string matches the boundary which exists after / (non-word character) and p (word character). Likewise \> matches the boundary which exists between e (word character) and : (non-word character). So finally a match would occur and the characters which are matched are replaced by the empty string.
But in the second case,
echo 'diff a/package/myname:/src/com/abc' | sed -e 's/\<\/package\/myname\:\>//g'
\< fails to match the boundary which exists between a and forward slash / because \< matches only between the non-word character (left) and a word character (right) . Likewise \> fails to match the boundary which exists between : and / forward slash because there isn't a word character in the left and non-word character at the right.
Solution:
So, i suggest you to remove the word boundaries <\ and />. Or, you could do like this,
$ echo 'diff a/package/myname:/src/com/abc' | sed -e 's/\>\/package\/myname\://g'
diff a/src/com/abc
I think now you could figure out the reason for the working of above command.