in reply to Re: Re: Unix Perl and Html
in thread Unix Perl and Html
do you have some examples of the output of printstatus? (you can change the names/ips to protect your network, we just want the formatting).
then this should work ok..
-p
If the output is a single line per printer you can use my previous example, otherwise there might be some work involved :)
Update:if the output is something along the lines of
name display toner level ----------------------------------- printer1 toner low 25% printer2 toner low 1% printer3 etc etc etc
then this should work ok..
#!/usr/bin/perl -w use strict; use CGI; my $main=new CGI; print $main->header; print $main->start_html("Printer Status"); open(STATUSFILE," your_outfile") || die "Cannot open logfile!: $!\n"; while(<STATUSFILE>) { chomp; if (! ($_=~ /-----------------------------------/)) { #my ($printer,$display,$toner,$level) = split(/ /, $_) +; my @status = split(/ /, $_); if (($status[0] eq "name") && ($status[1] eq "display" +)) { print "<center><table width=250 border=1><tr a +lign=center>\n"; for (@status) { print "<td><b>$_</b></td>\n"; } print "</tr>\n"; } else { for (@status) { print "<td>$_</td>\n"; } print "</tr>\n"; } } } print "</table>\n"; close(STATUSFILE); exit;
-p
|
---|
Replies are listed 'Best First'. | |
---|---|
Unix Perl and Html
by meccaxlr (Initiate) on Aug 16, 2001 at 18:05 UTC | |
Re: Re: Re: Re: Unix Perl and Html
by meccaxlr (Initiate) on Aug 16, 2001 at 18:52 UTC | |
Re: Re: Re: Re: Unix Perl and Html
by meccaxlr (Initiate) on Aug 17, 2001 at 00:56 UTC | |
by thatguy (Parson) on Aug 17, 2001 at 01:03 UTC | |
Re: Re: Re: Re: Unix Perl and Html
by meccaxlr (Initiate) on Aug 22, 2001 at 17:26 UTC | |
by thatguy (Parson) on Aug 22, 2001 at 20:14 UTC | |
by meccaxlr (Initiate) on Aug 27, 2001 at 18:33 UTC | |
by thatguy (Parson) on Aug 27, 2001 at 20:09 UTC | |
by dragonchild (Archbishop) on Aug 27, 2001 at 20:46 UTC |
In Section
Seekers of Perl Wisdom