I want to draw HTML table contain record of SQL query and send to mail in shell script. Here is the shell script:-

out=$(for id in 1 2 3 4
      sqlplus -s <user>/<password>@<db> <<EOF
      spool out.txt;
      select * from <table> where id=${id};
      spool off;

 echo ${out} > out.txt
(uuencode out.txt out.txt)| cat out.txt| mailx -s "Counts" abc@xyz.com

And I am getting output of the query in different format not HTML table format.

The table format should be like this (in the table)

ID            Results
        Before      After
1          12         15
2          27         30 
3          45         52

Could you please help me to draw HTML table of this record.

  • If you know PHP then you can use a php-cli script (php-cli.com) to retrieve the data and format it as HTML. You can then mail the output file. – rkhff Sep 27 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.