# Walt Uotinen - 4 July, 2000 # This script takes an HTML document you save to disk from the EZPass Detail listing # and strips the document down to a bare minimum which will allow it to be printed # without losing the "Amount" and "Balance" columns. # To accomplish this, the "Tag" column is stripped out of the table. # The trailing "Legend" of interchange abbreviations is reduced to only those you have # visited. # This program ONLY reads the "Exit Plaza" column to build the list of visited plazas. # If your report has "Entry Plaza" information, you'll need to tinker with the code... # Run this at either a DOS or Unix prompt as: # perl thisprogram.pl < input_file.htm > output_file.htm # where "input_file.htm" is what you saved from your browser and # "output_file.htm" will be a newly-created, viewable and printable HTML document. # Good luck! use English; undef $RS; # The input record separator is now undefined. $html = ; # $html now contains the entire web document. $html =~ s///s; #Strip leading HTML. $html =~ s/<\/BODY.*//s; #Strip trailingHTML. $html =~ s/.*?<\/TABLE>//s; #Strip unnecessary TABLE. $html =~ s/.*?<\/TABLE>//s; #Strip unnecessary TABLE. $html =~ s/.*?<\/TABLE>//s; #Strip unnecessary TABLE. $html =~ s/()/$1/g; #Remove "Tag" column. #Build an array of Plazas visited: while ($html=~/(.*?)<\/FONT><\/FONT><\/TD>/g) { $plazas_v{$1}++; } #Build an array of all Plazas: while ($html=~/()(.*?)( -.*?)<\/FONT><\/FONT><\/TD>/g) { $plazas_a{$2}=$3; } $html=~s/Legend.*?<\/TABLE>//s; #Strip trailing Legend TABLE print "\n\nPrintable EZPass Detail\n\n\n"; print $html; foreach $plaza (sort (keys (%plazas_v))) { if (defined ($plazas_a{$plaza})) { print "\n", $plaza, $plazas_a{$plaza}, "
"; } } print "\n\n";