I have written one script which connects to MYSQL database, fires one select query and send the results over an email, if there is any Output.
But the Output which I am receiving over email is in text format. I need to get it dispalyed in tabular format to ensure better readability. Below is the script I have tried and the sample email what I am receiving:
#!/bin/bash
#MAILTO="sambit.sahu@niceactimize.com"
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(20170811,'%Y%m%d') order by a.MIC;" > file.tmp
if [ -s file.tmp ]
then
mailx -s "Holiday" $MAILTO <file.tmp
fi
rm file.tmp
Below is the output, what I am receiving over mail. I want to convert it into tabular format with adding HTML formatting.
CenterID MIC ExchangeName CountryCode EventDate EventDayOfWeek eventName
706 XTKS Tokyo Stock Exchange JP 20170811 Fri Mountain Day