Postgre Query results as Email HTML table


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Postgre Query results as Email HTML table
# 1  
Old 04-10-2018
Postgre Query results as Email HTML table

Hello,

I'm trying to send email from Greenplum query results as HTML table with status Red/Green

Code:
Select Server, Last_Date from Table;

Results

Code:
Server, Last_Date
Prod, 2018-04-09

Final email Output in HTML format

Code:
Server   Status       LastDate
Prod    GREEN(BOX)  2018-04-09 (if the date is within 24 hours) - Green color status
UAT     RED (BOX)   2018-04-08 (if the date not within 24 hours) -- Red color Status


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 04-10-2018 at 01:44 PM.. Reason: Added CODE tags.
# 2  
Old 04-10-2018
What have you tried?
# 3  
Old 04-10-2018
You can get some ideas from this thread:
Help with awk color codes based on condition

Last edited by Chubler_XL; 04-10-2018 at 11:42 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regarding guidance related to HTML table in email body

Hello All, I have a query here. I am sending an HTML table(which I am creating it by a call to REST API, in a LINUX box) and from there I have to send it into an email. So following are the poins on same: As data is not static so it is writing Dynamic data and creating HTML file. There is... (9 Replies)
Discussion started by: RavinderSingh13
9 Replies

2. UNIX for Dummies Questions & Answers

Convert Txt file to HTML table and email

Hi all I need help converting a text file into a html table in bash and I need to email this table. The text file looks like the below. Two columns with multiple rows. Top row being header. Application Name Application Status Application 1 Open Application 2 ... (2 Replies)
Discussion started by: hitmanjd
2 Replies

3. Shell Programming and Scripting

HTML table in email body using C Shell

I am using Sun Solaris ver. 5.10 and trying to send an HTML table in email body using mail command in C shell script. I tried following commands:- #1 mail -m "MIME-Version: 1.0;Content-type:text/html;charset=UTF-8" receiver@mail.com < file.html #2 mail -m "Content-type: text/html;" -s "This... (4 Replies)
Discussion started by: jnrohit2k
4 Replies

4. Shell Programming and Scripting

I want query output to send on mail using table tag and output should be in table

#! /bin/ksh #] && . ./.profile 2>/dev/null if test -f '.profile'; then . ./.profile; fi; #. .profile LOG_DIR=/app/rpx/jobs/scripts/just/logs sendEmail() { pzCType="$1"; pzTitle="$2"; pzMsg="$3"; pzFrom="$4"; pzTo="$5"; pzFiles="$6"; pzReplyTo="$7" ( ... (21 Replies)
Discussion started by: ankit.mca.aaidu
21 Replies

5. Shell Programming and Scripting

Shell scripting unable to send the sql query data in table in body of email

I have written a shell script that calls below sql file. It is not sending the query data in table in the body of email. spool table_update.html; SELECT * FROM PROCESS_LOG_STATS where process = 'ActivateSubscription'; spool off; exit; Please use code tags next time for your code and data.... (9 Replies)
Discussion started by: Sharanakumar
9 Replies

6. Shell Programming and Scripting

[Solved] Shell script output in HTML or with table like results and mail

Hello, Currently i have a script which will disply the results in plain text format. I want to format the result in more readable format like Making bold headings and format with colors etc. Something like html and send that content as email. Please help me how i can do that. I am using... (10 Replies)
Discussion started by: joy lobo
10 Replies

7. Shell Programming and Scripting

SQL query output convert to HTML & send as email body

Hi , I have a sql query in the unix script ,whose output is shown below.I want to convert this output to HTML table format & send email from unix with this table as email body. p_id src_system amount 1 A 100 2 B 200 3 C ... (3 Replies)
Discussion started by: jagadeeshn04
3 Replies

8. Shell Programming and Scripting

Store results in table

Hello everyone, I have a shell script, which connects to the database and runs .sql file. after executing of .sql file, i need to store the results in error table. How can i achieve this one? could you please give your suggestions. here is my code. #!/bin/sh #set -vx SCHEMA_NAME=$1... (1 Reply)
Discussion started by: Rami Reddy
1 Replies

9. UNIX for Dummies Questions & Answers

Sending html email with html attachment

Hello, I have a script which is sending an html file as an attachment. #!/usr/bin/ksh export MAILTO="user@company.com" export CONTENT="/usr/tmp/file.html" export SUBJECT="EmailSubject" ( echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo "Content-Type: text/html" echo... (0 Replies)
Discussion started by: sreenathkg
0 Replies

10. Shell Programming and Scripting

shell script output in HTML or with table like results

Hello, Currently i have a ksh script which will disply the results in plain text format. I want to format the result in more readable format like Making bold headings and format with colors etc. Something like html or excel format and send that content as email. Please help me how i can do... (2 Replies)
Discussion started by: kotasateesh
2 Replies
Login or Register to Ask a Question