#!/bin/bash
ARR[0]="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1"
ARR[1]="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1"
ARR[2]="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1"
#printf "%s\n""${ARR[@]}" | /usr/bin/mutt -s "Hello Testing" abc@xyz.com
i=0
awk -v A="${ARR[@]}" '
BEGIN {
for (k in A)
print k } ' | /usr/bin/mutt -s "Hello Testing" abc@xyz.com
Though it's printing all lines but everything is coming as a single line in email, instead of 3 different lines.
No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1 No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1 No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1
---------- Post updated at 04:33 PM ---------- Previous update was at 04:32 PM ----------
Hello,
I am getting the following output in email. appreciate your help.
No
Differences
In
Stage
Between
HASH_TOTALS
&
HASH_TOTALS_COMP
For
UNINUM:0722075
PROVIDER:5
EXTRACT_DT:30-SEP-12
VER_NUM:1
This script output looks correct when i direct the output to teriminal.
But not in email everything coming as single line
awk -v A="$(printf "%s\n" "${ARR[@]}")" '
BEGIN {
split(A,B,"\n\n")
for (k in B)
print B[k] } '
---------- Post updated at 04:42 PM ---------- Previous update was at 04:39 PM ----------
I see the output coming in email as below, can we remove the additional blank lines in between.
No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1
No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1
No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1
Outlook is infamous for imposing formatting, to the point <pre> tags or sending all text as email attachments isn't unheard of to make text line up/appear proper.
This looks good works as expected, also i am curious is the same output or workaround possible with just printf statement and with out using awk ? what should i do to achieve it?