Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

cutting somethin with sed?

9 views
Skip to first unread message

astri...@gmail.com

unread,
Jun 5, 2019, 5:53:25 AM6/5/19
to
Hello!

I have a string like this:

<FONT FACE="Monospace,Courier">ABCD 050920Z 31004KT 9999 SCT026 22/14 Q1008</FONT><BR>

Inside the inner > <
(the text starting with in this example with ABCD)
I want to get out.
In this case:

ABCD 050920Z 31004KT 9999 SCT026 22/14 Q1008

How can I do it with sed?

Regards, Astrid

Adam Danischewski

unread,
Oct 20, 2019, 9:13:05 AM10/20/19
to
You could use capture groups, its not clear if you can rely on the formatting of your data.

sed -r 's/(^.*FONT FACE[^>]*>)([^<]*)([^>]*)(.*$)/\2/' <<< '<FONT FACE="Monospace,Courier">ABCD 050920Z 31004KT 9999 SCT026 22/14 Q1008</FONT><BR>'

This puts the text you are looking for into the second capture group and replaces the string with only the second capture group (\2).
0 new messages