Sponsored Content
Top Forums Shell Programming and Scripting Adding a blank line in between two O/Ps in tabular format which gets received over email Post 303002853 by Sambit Sahu on Monday 4th of September 2017 03:51:46 AM
Old 09-04-2017
Below is the content of mail.txt:

Code:
<table border=1>
<tr><td>CenterID        MIC     ExchangeName    CountryCode     EventDate       EventDayOfWeek  eventName</td></tr>
<tr><td>706     XTKS    Tokyo<\/td><td>Stock<\/td><td>Exchange  JP      20170811        Fri     Mountain<\/td><td>Day</td></tr>
</table><br>
<table border=1>
<tr><td>CenterID        MIC     ExchangeName    CountryCode     EventDate       EventDayOfWeek  eventName</td></tr>
<tr><td>903     XDFM    Dubai<\/td><td>Financial<\/td><td>Market        AE      20170831        Thu     El-Adha<\/td><td>1*</td></tr>
</table><br>

---------- Post updated 09-04-17 at 02:51 AM ---------- Previous update was 09-03-17 at 12:34 PM ----------

Hi,

So now Ia m getting the output as desired in the email. Below is the test script to check the format of the output over email:

Code:
#!/bin/bash

DT=(20170811 20170831)
for i in 0 1

do
#echo "<table border=1>"

mysql test -e "select c.CenterID,a.MIC,c.ExchangeName,a.CountryCode,a.EventDate,a.EventDayOfWeek,b.eventName from exch_calendar_event a left join exch_calendar_eventName b on a.EventID=b.ID left join exch_calendar_mic c on a.MIC=c.MIC where EventDate=DATE_FORMAT(${DT[$i]},'%Y%m%d') order by a.MIC;" | tr "\t" "~" > file.tmp

if [ -s file.tmp ]
then
  {
        echo "<table border=1>"
        while read -r LINE
        do
                LINE=$(echo $LINE|sed 's/~/<\/td><td>/g')
                echo "<tr><td>$LINE</td></tr>"
        done < file.tmp
        echo "</table><br><br>"
    } >> mail.txt
fi

done

cat header1 mail.txt footer | sendmail -t

And, following is the content in the mail.txt after execution of the script:

Code:
<table border=1>
<tr><td>CenterID</td><td>MIC</td><td>ExchangeName</td><td>CountryCode</td><td>EventDate</td><td>EventDayOfWeek</td><td>eventName</td></tr>
<tr><td>706</td><td>XTKS</td><td>Tokyo Stock Exchange</td><td>JP</td><td>20170811</td><td>Fri</td><td>Mountain Day</td></tr>
</table><br><br>
<table border=1>
<tr><td>CenterID</td><td>MIC</td><td>ExchangeName</td><td>CountryCode</td><td>EventDate</td><td>EventDayOfWeek</td><td>eventName</td></tr>
<tr><td>903</td><td>XDFM</td><td>Dubai Financial Market</td><td>AE</td><td>20170831</td><td>Thu</td><td>El-Adha 1*</td></tr>
</table><br><br>

So, now I need to modify the script to run the query to check, if there is any holiday in last 3 business days.

Thanks!!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

adding blank line in egrep

I followed the egrep example given in the thread "parse text or complex grep ?". It is exactly what I need...except... how do I insert a blank line after the second line? My exact command is: egrep 'patt1|patt2' filename the result is: patt1 patt2 patt1 patt2 and so on. I would... (2 Replies)
Discussion started by: antalexi
2 Replies

2. Shell Programming and Scripting

Need help in sed command (adding a blank line btw each block generated by pattern)

Hello friends, I have a C source code containing sql statements. I use the following sed command to print all the sql blocks in the source code.... sed -n "/exec sql/,/;/p" Sample.cpp The above sed command will print the sql blocks based on the pattern "exec sql" & ";"... (2 Replies)
Discussion started by: frozensmilz
2 Replies

3. Shell Programming and Scripting

SED - adding blank line after each Range Match

the following range matching works great but i wish to add a blank line after each range result set... which i've tried and researched to no avail MY INPUT DATA: CURRENT CODE I'M USING: sed -n '/*$/,/;/p' $INPUT_FILE RESULTS I'M GETTING: RESULT I looking to... (5 Replies)
Discussion started by: danmauer
5 Replies

4. Shell Programming and Scripting

Fill the empty line by adding line before blank line

FIle A "A" 2 aa 34 3 ac 5 cd "B" 3 hu 67 4 fg 5 gy output shud be A"" 2 aa 34 "A" 3 ac 34 "A" 5 cd 34 "B" 3 hu 67 "B" 4 fg 67 "B" 5 gy 67 (6 Replies)
Discussion started by: cdfd123
6 Replies

5. Shell Programming and Scripting

Adding a blank line after every 5th line

Hello... I have a file which contain certain number of records. I want to generate another file from this file which will contain 1st line as a blank line & after every 5 lines one blank line will be inserted. How to achieve this through shell scripting? Thanks... (5 Replies)
Discussion started by: 46019
5 Replies

6. Shell Programming and Scripting

sed adding a blank line

I use the following as part of a script to correct for a faulty hostname file. # get the domain name read -r thehostname < /etc/hostname dom="$(echo $thehostname | cut -d'.' -f2)" numchar=${#dom} if then echo "It appears as though the hostname is not correctly set." echo "Hostname has... (5 Replies)
Discussion started by: bugeye
5 Replies

7. Shell Programming and Scripting

Displaying output in the tabular format

Hi I want to display the following input data into the tabular format as shown in the output. Input.txt: Following jobs are in pending state for more than 10 minutes: JOB_ID JOB_SUBMIT_ID MAHAR 784308 PUNJA 109367 Following jobs are running for longer time: JOB_ID... (1 Reply)
Discussion started by: dats
1 Replies

8. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

9. Shell Programming and Scripting

Required to get out put of log in tabular format in email body

Dears Please support I have out put in text file and look like below fixed inquiries - Click on MAX suffix http://server:port/app User Details http://server:port/app Audit User Detail Action hhttp://server:port/app fixed inquiries - Click on MAX suffix http://server:port/app User Details ... (13 Replies)
Discussion started by: mirwasim
13 Replies

10. Shell Programming and Scripting

To have a mail in tabular format

Hello Guys, developing a monitoring shell script to have my queue depth count over mail . here is the sample input file to the script which has all the queue names 1 : DISPLAY QUEUE(*) WHERE (CURDEPTH GT 0) ZFC8409: Display Queue details. QUEUE(QL.GVR.ATA.CACHE.01) ... (10 Replies)
Discussion started by: wims
10 Replies
gss_unwrap(3)						     Library Functions Manual						     gss_unwrap(3)

NAME
gss_unwrap - verify a message with attached message integrity code (MIC) and decrypt message content if necessary SYNOPSIS
DESCRIPTION
The routine converts a protected message to a usable form and verifies the embedded message integrity code (MIC). The conf_state parameter indicates whether the message was encrypted. The qop_state parameter indicates the quality of protection that was used to provide the con- fidentiality and integrity services. Input Parameters context_handle Specifies the context on which the message arrived. input_message_buffer Specifies the protected message. output_message_buffer Specifies the buffer to receive the unwrapped message. Output Parameters conf_state Returns the requested level of confidentiality and integrity services, as follows: Non-zero Both confidentiality and integrity services were used. zero Only integrity services was used. qop_state Returns the cryptographic algorithm, or quality of protection. minor_status Returns a status code from the security mechanism. STATUS CODES
The following status codes can be returned: The routine was completed successfully. The signature was incorrect. The context has already expired. The context is recognized but the associated credentials have expired. The token failed consistency checks. The token was valid and contained the correct signature but it had already been processed. The routine failed. The context specified in the context_handle parameter was not valid. The context identified in the context_handle parameter was not valid. The token was valid and contained the correct signature but it is too old. The token was valid, and contained a correct MIC for the message, but has been verified out of sequence; a later token has already been received. The token was valid, and contained a correct MIC for the message, but has been verified out of sequence; an earlier expected token has not yet been received. AUTHOR
was developed by Sun Microsystems, Inc. SEE ALSO
gss_get_mic(3), gss_wrap(3). gss_unwrap(3)
All times are GMT -4. The time now is 11:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy