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
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
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
All Courses

From novice to tech pro — start learning today.