For the text ABC<img src="test"></a>
, I'm hoping to get rid of the <img ...>
part, in other words, I want the result to be displayed as: ABC</a>
. I tried several patterns, but none of them worked.
echo 'ABC<img src="test"></a>'|sed -e "s/<img src=\".*>//g"
ABC
I don't know whether I should escape <
or >
, When I did, I got the following result:
echo 'ABC<img src="test"></a>'|sed -e "s/\<img src=\".*\>//g"
ABC<>
Can anyone clarify these results and give me a satisfying one?