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