tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: HTML parser (not Tru64 specific)
@ 2001-05-06 11:09 Nikola Milutinovic
  0 siblings, 0 replies; only message in thread
From: Nikola Milutinovic @ 2001-05-06 11:09 UTC (permalink / raw)
  To: tru64-unix-managers

Thanks to a lot of people.

William_Bochnik@acml.com		Suggested Perl, Perl, Perl
"Angel R. Rivera" <angel@wolf.com>	Sugested I use XML.
Mark.Deiss@acs-gsg.com			Gave a sed script.

I STILL haven't learned Perl, I've never even smelled XML. "sed", however is a
different story.

I'm donating Mark's solution.

sed -ne '
    # only going to operate on patterns prefaced with the <td...> html tag
    /<td/{
        # this is a re-entry point to permit continued operation spanning
          multiple lines
        : branch1
        # check whether the pattern space has the closing </td> html tag
        /<\/td>{
            # do some housekeeping edits
            #  remove any multi-line carriage returns, pad with spaces
            #  remove the <td...> and </td> html tags
            s/\n/ /g
            s/<td[^>]*>//
            s/<\/td>//
            # print the resulting pattern space
            p
            # branch to the end of the loop
            b 
        }
        # have not found closing </td> html tag, read another line into the
          pattern space
        N
        #  jump to the top of the inner loop and check for the </td> html
           closing tag
        b branch1
    } '  your_html_filename

Nix.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-06 11:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-06 11:09 SUMMARY: HTML parser (not Tru64 specific) Nikola Milutinovic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox