Formating Mail Body data into html table format Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Formating Mail Body data into html table format without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I have a hive query result in tab separated format. I am storing it into a file like

query="select Name, age from table;"
echo $query | hive > test.csv

Now I want to send it in mail using mutt command in tabular format. I am using command:

mutt -e -n "set Content-Type:text/html" -s"This is my mail" <test.csv

It shows result in mail body as tab separated format I want to make it in tabular format.

query result is in test file like this. and this is appear in mail body

NAME    ssingh
AGE    20

Currently It is separated by Tab and I want to convert it in html table format in mail body

Now I am able to generate data in excel 2003 format. Can we convert the excel data into HTML table and send it in mail body using mutt.

Answer

So finally I did it:

First I converted tab separated file into , separated file. Here is command

sed -i 's/t/,/g' $filepath/test.csv

Now converted , separated file into test.html file. Here is code link:

http://www.unix.com/unix-dummies-questions-answers/118855-convert-csv-html-file.html

Then

mutt -e -n "set Content-Type:text/html" -s"This is my mail" < test.html

This will print file content in html tabular format in mail body

We are here to answer your question about Formating Mail Body data into html table format - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji