Re: [SLUG] Fun with perl

From: Brett Simpson (Simpsonb@hillsboroughcounty.org)
Date: Fri Mar 22 2002 - 16:58:50 EST


I got it.

#!/usr/bin/perl
print "Content-Type: text/plain \n\n";

$file = '/var/www/html/auth.log';
open (INFO, $file);
while (<INFO>){
        if ($_ =~ /$ENV{QUERY_STRING}/) {
                print "$_";
        }
}
@lines = <INFO>;
close (INFO);

>>> jcopenha@typedef.org 03/22/02 03:13PM >>>
you need to sub the newlines with <BR>.. or.. you could put <PRE> tags
around it.. you'll lose the font..but it will honor the newlines..

On Fri, 22 Mar 2002, Brett Simpson wrote:

> I'm looking to use this script in my apache cgi-bin so that users can list specific contents of a file in their web browser. It works ok except that it jumbles the lines togethor. Is there a cleaner way to do this so that it looks readable?
>
> #!/usr/bin/perl
> print "Content-Type: text/html \n\n";
>
> print `cat -b /var/www/html/auth.log | grep joeuser`;
>
>
> Brett
>
>
>



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:29:43 EDT