in reply to How to parse a logfile to a HTML table format

print "<table border='3'>\n"; while (<DATA>) { next if m/^\s*$/; my @elements = split /\s+/, $_; print <<" LINE"; <tr> <td>@elements[0..4]</td> <td>$elements[5]</td> <td>$elements[6]</td> </tr> LINE } print "</table>"; __DATA__ Sat Jul 21 22:30 2001 144.02.26.399 www.myserver.com ... Sat Jul 21 23:01 2001 352.34.12.345 www.myserver.net

I read from the DATA filehandle for this demo. You will need to open your logfile to a filehandle to read from it. You do that like this:

print "<table border='3'>\n"; open FILE "</path/to/logfile.txt" of die "Oops $!\n"; while (<FILE>) { next if m/^\s*$/; my @elements = split /\s+/, $_; print <<" LINE"; <tr> <td>@elements[0..4]</td> <td>$elements[5]</td> <td>$elements[6]</td> </tr> LINE } print "</table>"; close FILE;

Normally I would also post some explanation but as you have not posted any code I will leave it up to you to research anything in this code that is unfamiliar. You will need to add the usual HTML HEAD and BODY tags to complete a valid page.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print