Hi,

Multiple ways of doing this :

#!/usr/bin/perl

use strict;

my $logfile = "...";

open(FH, "<$file");
my @contents = <FH>;
close (<FH>);

print "<pre> @contents </pre>";

# ---------------------

or

print "<table><tr><th>USER</th><th>PID</th><th>PPID ..........  </th></tr>";
foreach $line(@contents) {
  
  ##
  $line =~ s/\s+/<td>/g;
  print "<tr> $line </tr>";  
  
  ## OR
    ($user, $pid, $ppid, $cpu, $time, $comm) = split(/\s+/, $line);
   print "<tr><td>$user</td><td>.. ... .... </tr>";
 
}


Regs David

-------------------------
> 
> Hi everybody
> 
> I've got text file on the local machine and Apache too.
> 
> What I don't know is how can I display this file like html file using cgi.
> The file looks like:
> 
> USER   PID  PPID %CPU        TIME COMMAND
>      user 26794 26002  0.0        0:00
>      user  4687  4685  0.0        0:00 -ksh
>      user 15120 15118  0.0        0:00 -ksh
>      user 18918 18821  0.0        0:00 -ksh
>      user 21894 21885  0.0        0:00 -ksh
>      user 26719 26716  0.1        0:00 -ksh
>      user 26795 26719  0.0        0:00 -ksh
> 
> I mean that the result of this cgi program is displayed the same like file
> text.
> 
> Can you help me?
> 
> Martin Pestun
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to