tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Nikola Milutinovic <Nikola.Milutinovic () ev ! co ! yu>
To: tru64-unix-managers
Subject: SUMMARY: HTML parser (not Tru64 specific)
Date: Sun, 06 May 2001 11:09:59 +0000	[thread overview]
Message-ID: <102653647621708.tru64-unix-managers.marc@archive.invalid> (raw)

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.

                 reply	other threads:[~2001-05-06 11:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

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