#!c:/perl/bin/perl #This version allows the use of a filename specified on the command line use strict; use warnings; package HTMLStrip; use base "HTML::Parser"; #system("cls"); my $output = "c:/perl/bin/parseOutput.txt"; if (-e $output) { unlink $output; } open PARSETEXT,'>',$output or die $!; my $p = new HTMLStrip; # parse line-by-line, rather than the whole file at once while (<>) { $p->parse($_); } # flush and parse remaining unparsed HTML $p->eof; close PARSETEXT; sub text { my ($self, $text) = @_; chomp($text); $text =~ s/#.*//; # comments $text =~ s/^\s+//; # leading whitespace $text =~ s/\s+$//; # trailing whitespace #Once the beginning comment if found, remove style if ($text =~ /^<\!--$/) { next unless ($text =~ /^-->$/); } #Print non-blank lines if (length($text) > 0) { print PARSETEXT $text . "\n"; } } #Process OPENING/STARTING HTML tags sub start { my ($self, $tag, $attr, $attrseq, $origtext) = @_; #We're only interested in dealing with table tags if ($tag =~ /^table$/) { print PARSETEXT "\n************* BEGIN TABLE ****************\n"; } if ($tag =~ /^tr$/) { print PARSETEXT "\n"; } if ($tag =~ /^td$/) { print PARSETEXT "\t"; if (defined $attr->{'class'}) { if ($attr->{'class'} =~ /alarmClear/) { print PARSETEXT "OK"; } if ($attr->{'class'} =~ /alarmSet/) { print PARSETEXT "ALARM"; } } } } #Process CLOSING/ENDING HTML tags sub end { my($self, $tag, $origtext) = @_; if ($tag =~ /^table$/) { print PARSETEXT "\n************* END TABLE ****************\n"; } } #### ############################################################ ############################################################ HTML FILE CONTENTS System Status

System Status

Timestamp 2010:03:09 - 18:26:45
System Uptime 16 days 3 hours 5 minutes
Software Version 2.2.4 REL
Serial Number CFB90357-000000
Model Number DSP85-C/P
Item Number CS10-377-403
Location Unknown
Band 1 (CELL) Band 2 (PCS)
Active Filter cgA0-0pgA0B4B5F0C5-0
Power Down Link Up Link Down Link Up Link
In-band Input? (dBm) -35.6≤ -66.0-43.4≤ -66.0
Measured Output? (dBm) 18.6≤ 4.022.8≤ 4.0
Composite Input? (dBm) -33.9-43.4-23.7≤ -53.0
Gain Control
AGC Mode OnOn
AGC Attenuation (dB) 0.00.00.00.0
System Gain 53.570.066.070.0
RF Alarms
Over Range
Oscillation
VSWR
Out of Band Overdrive
Low Signal
No Signal
System Alarms
Synthesizer Lock
Voltage
Temperature
Software
Hardware