in reply to Grabing a Page and Need to Parse it..

General HTML parsing could be done via HTML::Parser and its relatives. Looking at your snippet of HTML, it seems that you will find HTML::TableExtract useful
  • Comment on Re: Grabing a Page and Need to Parse it..

Replies are listed 'Best First'.
Re: Re: Grabing a Page and Need to Parse it..
by LostS (Friar) on May 07, 2001 at 21:04 UTC
    I found it...
    $traffictotals =~ s/<!-- Begin MRTG Block -->(.*?)<!-- End MRTG Block + -->//s;
    Works great :)
      Looks like you're parsing output from Multi Router Traffic Grapher, a neat SNMP tool that fetches bandwidth utilization info and generates HTML pages from those stats.

      Instead of parsing it's HTML output back into text, you might consider using UCD SNMP to query the device(s) directly.   UCD-SNMP includes snmpwalk and other command-line tools that are pretty slick.

      For a more perlish solution, Net::Snmp would also do the trick.   "(code) mind your snmPs & Qs" shows yet another perlish approach, this time using CPAN module SNMP to query devices for info.

      There are any number of possible reasons why these wouldn't work in your situation, but they seem worth mentioning.
          cheers,
          Don
          striving toward Perl Adept
          (it's pronounced "why-bick")