Sponsored Content
Top Forums Shell Programming and Scripting Please help in populating output in table using shell scripting Post 302935988 by ankit.mca.aaidu on Saturday 21st of February 2015 06:45:15 AM
Old 02-21-2015
I tried set markup html on, still its not working

Code:
#!/bin/ksh

#[[ -f ./.profile ]] && . ./.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"
        (
          echo "From: $pzFrom\nTo: $pzTo\nSubject: $pzTitle${pzReplyTo:+\nReply-To: $pzReplyTo}"

              [[ -n "$pzCType" ]] && echo "Content-Type: $pzCType"

              echo
               echo "$pzMsg"
                  [[ -n "$pzFiles" ]] &&
                  echo &&
                  for pzFile in $pzFiles
                  do
                    [[ -f "$pzFile" ]] && uuencode "$pzFile" "$pzFile"
                  done

                ) | mail "$pzTo"
          }

## all pending subscriber .

pending=`sqlplus -s pag_app/abcdef@prpx1-vip.unix.gsm1900.org:7779/prpx.unix.gsm1900.org <<EOF
set feedback off;
set markup html on;
set heading off;
set trimspool on;
set pagesize 0;
SET LINESIZE 180;

select '<tr><td>'||msisdn||'</td><td>'||status_changed_time||'</td><td>'||rate_plan_id||'</td><td>'||status||'</td></tr>' from sub
scriber where status = 'P' and status_changed_time < sysdate order by status_changed_time  desc;
EOF`

activating=`sqlplus -s pag_app/abcdef@prpx1-vip.unix.gsm1900.org:7779/prpx.unix.gsm1900.org <<EOF
set feedback off;
set markup html on;
set heading off;
set trimspool on;
set pagesize 0;
SET LINESIZE 180;

select '<tr><td>'||msisdn||'</td><td>'||status_changed_time||'</td><td>'||rate_plan_id||'</td><td>'||status||'</td></tr>' from sub
scriber where status = 'I' and status_changed_time < sysdate order by status_changed_time  desc;
EOF`

final="Pending
    <table><tr><td>Msisdn    </td><td>      Date    </td><td>    RP Status </td></tr>
    $pending
    </table>
    Activating
        <table> <tr><td>Msisdn     </td><td>     Date   </td><td>     RP Status  </td></tr>
        $activating
        </table>"
sendEmail '' "Pending_Activating" "$final" 'ankit.gupta92@gmail.com' 'balaji.k@gmail.com' " " ' '
exit 0;

Output is as below
Code:
Pending
    <table><tr><td>Msisdn    </td><td>      Date    </td><td>    RP Status </td></tr>
    <p>
<table border='1' width='90%' align='center' summary='Script output'> <tr> <td> &lt;tr&gt;&lt;td&gt;12198057608&lt;/td&gt;&lt;td&gt;21-FEB-15&lt;/td&gt;&lt;td&gt;173&lt;/td&gt;&lt;td&gt;P&lt;/td&gt;&lt;/tr&gt;
</td>
</tr>
</table>
<p>
    </table>
    Activating
	<table> <tr><td>Msisdn     </td><td>     Date   </td><td>     RP Status  </td></tr>
	<p>
<table border='1' width='90%' align='center' summary='Script output'> <tr> <td> &lt;tr&gt;&lt;td&gt;19175889670&lt;/td&gt;&lt;td&gt;21-FEB-15&lt;/td&gt;&lt;td&gt;183&lt;/td&gt;&lt;td&gt;I&lt;/td&gt;&lt;/tr&gt;
</td>
</tr>
<tr>
<td>
&lt;tr&gt;&lt;td&gt;17027857667&lt;/td&gt;&lt;td&gt;19-FEB-15&lt;/td&gt;&lt;td&gt;156&lt;/td&gt;&lt;td&gt;I&lt;/td&gt;&lt;/tr&gt;
</td>
</tr>
<tr>
<td>
&lt;tr&gt;&lt;td&gt;12068591961&lt;/td&gt;&lt;td&gt;15-FEB-15&lt;/td&gt;&lt;td&gt;176&lt;/td&gt;&lt;td&gt;I&lt;/td&gt;&lt;/tr&gt;
</td>
</tr>
<tr>
<td>
&lt;tr&gt;&lt;td&gt;12064460516&lt;/td&gt;&lt;td&gt;15-FEB-15&lt;/td&gt;&lt;td&gt;176&lt;/td&gt;&lt;td&gt;I&lt;/td&gt;&lt;/tr&gt;
</td>
</tr>
<tr>
<td>
&lt;tr&gt;&lt;td&gt;19544713197&lt;/td&gt;&lt;td&gt;31-JAN-15&lt;/td&gt;&lt;td&gt;156&lt;/td&gt;&lt;td&gt;I&lt;/td&gt;&lt;/tr&gt;
</td>
</tr>
</table>
<p>
	</table>

Moderator's Comments:
Mod Comment Please stop using QUOTE tags to mark text that has not appeared before.

Please use CODE tags (not QUOTE tags) to display sample input and output.

Last edited by Don Cragun; 02-21-2015 at 08:48 AM.. Reason: Fix tags again. (Remove yellow code that disappears on gray background.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk - Pre-populating an array from system command output

So, here's a scenario that requires the same logic as what I'm working on: Suppose that you have a directory containing files named after users. For awk's purposes, the filename is a single field-- something parse-friendly, like john_smith. Now, let's say that I'd like to populate an array in... (2 Replies)
Discussion started by: treesloth
2 Replies

2. Shell Programming and Scripting

Create a table using shell scripting

Hi Can we create a rectangular table as i have attached in the query . This is primarily for populating the created table with data gathered . Hope I made myself clear ... Pls suggest Thanks (1 Reply)
Discussion started by: ultimatix
1 Replies

3. Shell Programming and Scripting

How to Add Table with Header for Shell Output

I have a Script that generates 3 columns of the result. The line script is /usr/xpg4/bin/awk -F' ' '{print $1 /t $2}' File_Name | awk -F'>' '{print $2}' | cut -d'<' -f1 | sort -rn | uniq -c The output of the Command is : Code.500 4 Input Error Code.404 ... (4 Replies)
Discussion started by: raghunsi
4 Replies

4. Shell Programming and Scripting

How to get the file size and count of a table using shell scripting?

Hi there, im a beginner to the shell scripting.i trying to extract a table from a db(IMD) and i have to get the count of that table and size of the file. can you help me out how to write the shall scriping for the above query. (2 Replies)
Discussion started by: pawanmamidi
2 Replies

5. Shell Programming and Scripting

How to update a Oracle table through shell scripting?

My Code is get_week_date() { `sqlplus -s ${DQM_SQL_LOGON}@${DQM_SID} << EOF SET ECHO OFF SET FEEDBACK OFF SET PAGES 0 SET SERVEROUTPUT ON SET VERIFY OFF SET TRIMSPOOL ON (update file_level_qc fq set FQ.DATA_FILE_NAME='Hyvee_Pharmacy_Solutions_201304_v1.txt'... (2 Replies)
Discussion started by: karthick.cho
2 Replies

6. 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

7. 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

8. UNIX for Advanced & Expert Users

How can i populate the record in to table using shell scripting?

LOG_DIR=/app/rpx/jobs/scripts/just/logs sendEmail() { pzCType="$1"; pzTitle="$2"; pzMsg="$3"; pzFrom="$4"; pzTo="$5"; pzFiles="$6"; pzReplyTo="$7" ( echo "From: $pzFrom\nTo: $pzTo\nSubject: $pzTitle${pzReplyTo:+\nReply-To: $pzReplyTo}" ] && echo... (1 Reply)
Discussion started by: ankit.mca.aaidu
1 Replies

9. Forum Support Area for Unregistered Users & Account Problems

Creation of Oracle table through shell scripting

Hi, I am trying to create a table through shell scripting . I used a command sqlplus -s to connect to sqlplus and user as sysdba. but there is a problem in it. can anyone please solve this . #!/bin/bash $(`sqlplus -s / as sysdba <<eof create table sample (id,int); insert into sample... (1 Reply)
Discussion started by: Unregistered
1 Replies

10. Shell Programming and Scripting

Shell output format like table

Hi, OS: Redhat 7.5 shell: Bash Wrote below script to login into oracle via shell script and trying to reset locked account..It works as expected. But I need specific output << EOF should go to target terminal not all out put running below script from ansible command line.. #!/bin/bash... (1 Reply)
Discussion started by: onenessboy
1 Replies
All times are GMT -4. The time now is 09:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy