theravadamonk has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl Monks,
I hv a /tmp/quarantine.ok file". It's contents are given below
May 3 15:58:17 SPAM sender@domain.com peter.w@recipient.com spam-Lub +_LynRmcvj.gz May 3 15:58:24 SPAM sender@domain1.com coev074@recipient1.com spam-g +SCAdAuMpiD0.gz May 3 15:59:27 BANNED sender@domain2.com nadia.meli@grecipient2.com +banned-BpF8aM7FM48B May 3 16:00:29 SPAM sender@domain.com sascha_ste@recipient.com spam- +6fFrrzUjgvug.gz May 3 16:01:48 INFECTED sender@domain3.com philipp_me@recipient.com +virus-SZLvi-VO4IIv May 4 16:02:28 SPAM sender@domain.com caro.grill@recipient3.com spam +-saYzvikxOfVL.gz May 4 16:02:45 SPAM sender@domain.com pellitter@recipient.com spam-8 +K649OHNlRQ2.gz May 4 16:03:14 SPAM sender@domain1.com anton.d@recipient.com spam-3r +pUGn3IcDnG.gz
I am currently displaying its contents with CGI via web browser. This is my code.
#!/usr/bin/perl use CGI ':standard'; use strict; use warnings; use CGI::Carp 'fatalsToBrowser'; # use only for testing $ENV{"PATH"} = "/usr/sbin:/usr/bin:/sbin:/bin"; print "Content-Type: text/html; charset=utf-8\n\n"; print "<body bgcolor=\"#95B8DB\" onload=\"parent.adjustMyFrameHeight() +;\">"; print "<div style=\"min-height:500px; dispaly:block;\">"; open FILE, "/tmp/quarantine.ok" or die $!; while(<FILE>) { chomp; print "$_\n\n"; print "<br />"; print "<br />"; print " \n"; } close FILE; print "</div>"; print "</body>";
Now, I want to INSERT file contents inside a table. I need these below table headers
TIME CATEGORY Sender Recipients Quarantined-ID . Under those I want to display table data.
Under time, Date and Time should displayed, Under CATEGORY, it's CATEGORY should be displayed ( whether its SPAM, BANNED or INFECTED). Under sender, email senders. Under recipients, recipients. Under Quarantined-ID, Quarantined-ID should be displayed.
How can I achieve it?
I came across this URL.
http://www.perlmonks.org/bare/?node_id=86850
But, I can't get it done.
Your ideas r welcome.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: INSERT file contents inside a table
by poj (Abbot) on May 28, 2018 at 06:58 UTC | |
by theravadamonk (Scribe) on May 28, 2018 at 10:06 UTC | |
by poj (Abbot) on May 28, 2018 at 12:34 UTC | |
by theravadamonk (Scribe) on Jun 04, 2018 at 09:38 UTC | |
by theravadamonk (Scribe) on Jun 06, 2018 at 11:04 UTC | |
by poj (Abbot) on Jun 06, 2018 at 14:24 UTC | |
| |
by rnewsham (Curate) on May 28, 2018 at 11:21 UTC | |
by theravadamonk (Scribe) on Jun 04, 2018 at 09:44 UTC | |
|
Re: INSERT file contents inside a table
by rnewsham (Curate) on May 28, 2018 at 08:39 UTC |