Working with Sed on Mac osx 10.6.8 creating a .command file with Text Editor which will be executed in Geektool. I have a string MYSTRING and try to remove the link-tags from it. But when using the wildcard Sed seems to select a too long range.
MYSTRING="<link>part_1</link>This part must remain.<link>part_x</link> Like this part."
echo $MYSTRING |
sed s/"<link>".*"<\/link>"//g
I had expected this result:
This part must remain. Like this part.
But the actual result is:
Like this part.
It seems that Sed takes the first link as the from-value and the last /link as the to-value, causing everything in between to be deleted. How do I make Sed understand it should take the first /link after link rather than taking the last?
Because
.*
is greedy. Try: