Re: Yahoo! Groups: Welcome to sed-users. Visit today!

Luigi Assom <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <CAEiLF=u3N8gZ=Zo+O=sHVW7_ihzH+5ok1-EidNsPsm=prcJd8Q@mail.gmail.com>
Hi community!
I subscribed to sed group because I need to do some parsing of txt files
with html.
I am totally new to sed, I 've just discovered it yesterday!!
I tried something (strip all html tag) and I succeed, but I need something
more complex and I cannot dig it - could you please help with the syntax?

I need to extract URL contained in <a> tags, only the part like /RED/BLUE/
, and to strip out every other tag, so that I have clean text and only
THOSE urls.

I made this attempt:

txt structure:

> </b> (Displaying X Results)<table><tr> <td valign="top"><a
> href="/RED/BLUE/" onClick="(new Image()).src='/url/';"><img src="image.jpg"
> width="30" height="30" border="0"></a>&nbsp;</td><td align="right"
> valign="top"><img src="/images/c.gif" width="1" height="6"><br>1.</td><td
> valign="top"><img src="/images/c.gif" width="1" height="6"><br><a
> href="/RED/BLUE/" onclick="(new Image()).src='url/';">TEXT TO EXTRACT</a>
> TEXT TO EXTRACT                 <p class="find-alike">alike "OTHER TEXT TO
> EXTRACT" - BLABLA <em>(blabla)</em></p>       <p class="find-alike">alike
> "OTHER TEXT TO EXTRACT" - BALABLA</p>   </td></tr><tr> <td
> valign="top"><img src="/images/b.gif" alt="" width="23" height="1"></td><td
> align="right" valign="top">2.</td><td valign="top"><a href="/RED/BLUE/"
> onclick="(new Image()).src='url/';">TEXT TO EXTRACT</a> TEXT TO EXTRACT
>               </td></tr>
>

command:
sed -e 's/<[^>]*>//g;/</N;//b'

it works, but strip out all tags.

I've tried to customize it, but nothing happened:
sed -e '/RED/!d;'

I also tried some script on the web but I cannot make them work...
I even new in using Unix :)
I am working with macbook sed based.


Could you please help out in this task?
Thank you!
Luigi


[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.