Bash shell script that inserts a text data file into an HTML table

hi ,
i need to create a bash shell script that insert a text data file into an html made table, this table output has to mailed.I am new to shell scripting and have a very minimum idea of shell scripting.
please help.

Pls post sample input and the output you are expecting.

input:

email address
subject

processname param2 param3 param4 param5 param6
1 a b c d e
2
3..
4..
...
...
21..

output:

This content has to be put into an html table and mailed to the specifed address

If the input file has the format you specify a Perl script seems the obvious route, the script below is untested and just an outline.

#! /usr/bin/perl

use strict;
use warnings;

open (my $in_file , '<', "$ARGV[0]");
my $path_to_sendmail="/usr/sbin/sendmail -t";
my $position=0;# 0=>initial empty line(s), 1=>email address,2=>subject,3=>ignore empty line(s), 3=>table headings,4=>data lines
my (%mail);
while(<$in_file>){
   if ( ($position == 0 ) && (!/^\s*$/) ){ 
      chomp($mail{address}=$_);
      $position++;
   }
   elsif( ($position == 1) && (!/^\s*$/) ){
      chomp($mail{subject}=$_);
      $position++;
    }
   elsif( ($position == 2) && (/^\s*$/) ){
      $position++;
   }
   elsif ( ($position == 3) && (!/^\s*$/) ){
      $mail{body}="<html><head><title>$mail{subject}</title></head><body><table>";
      my @headings=split(/\s+/, $_);
      $mail{body}.='<tr><th>', join('</th><th>', @headings), '</th></tr>';
      $position++;
   }
   elsif ($position==4){
      my @record= split (/\s+/,$_);
      $mail{body}.= '<tr><td>', join('</th><td>', @record), '</td></tr>';
   }
}
$mail{body}.='</table></body></html>';
close ($in_file);
open (my $sendmail ,'|', "$path_to_sendmail") || die "Did you forget to set the location of your sendmail binary?, current value is \"$path_to_sendmail\"\n";
print $sendmail "From: monitoring.script\@localhost\n";ject
print $sendmail "To: $mail{address}\n";
print $sendmail "Content-type: text/html";
print $sendmail "Subject: $mail{subject}\n\n";
print $sendmail $mail{body};
close($sendmail);
exit;

thanks a lot. will see if this works.
could this be done in a bash shell script using sed and awk utlities ?

It probably could, Perl just seems a natural fit for the task though

Given the sudden restrictions popping up in your other thread I have to ask if this is homework?

No. It isn't homework, but it is a part of my internship project. Sed and awk are the only tools i've been told about, and am completely unaware about perl.
Apologies for the not formentioning all the details. Any help would be much appreciated.

Just because you're not aware of Perl doesn't mean you can't use it, as long as you give due credit. And if you can't use it it's probably because you're not allowed to ask others for the answer. In that case we also won't help you cheat.

I am allowed to take help from whoever, just that being an intern for a limited peroid and an assigned project, i do not get much help from where i work.
I do understand your concern though.
thanks.