sed question

Hi,

how can I tell sed to substitute the SHORTEST matching string and not the longest?

Example:
echo "<BR>Hello</FONT>test" | sed "s/.*>//;"

--> "test" is the output but I just wanted the string until the first ">" be replaced.

Thanks
hitzeuAsked:
Who is Participating?
 
ahoffmannConnect With a Mentor Commented:
echo "<TAG1>text text text <TAG2> text_end" | sed -e 's/<[^>]*>//g'
0
 
biraCommented:
echo "<BR>Hello</FONT>test" |rev| sed "s/.*>//;"|rev
0
 
ozoCommented:
echo "<BR>Hello</FONT>test" | sed "s/[^>]*>//;"
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
hitzeuAuthor Commented:
Works, thanks.
And what if I wanted to filter out all TAGS inside a string ?

echo "<TAG1>text text text <TAG2> text_end" | sed .... ?
---> "text text text   text_end"
0
 
hitzeuAuthor Commented:
can't thank you enough....
0
 
mrn060900Commented:
what about the points for ahoffmann?
0
 
hitzeuAuthor Commented:
good question..... he does not post answers, "just" comments.

Ahoffmann, how can I reward you :-)
0
 
mrn060900Commented:
just accept his comment as the answer.
0
 
hitzeuAuthor Commented:
oops
0
 
ahoffmannCommented:
no more comments neede. Points arrived ;-)
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.