Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
2  
For those of us who don't know hive, can you show us the format of the test file (i.e. show us some of the content). –  EightBitTony Jul 17 '13 at 8:15
    
in addition to what EightBitTony mentioned. It seems want to send the mail in html, when you say tabular do you mean convert the file to html table? Or do you mean list of values separated by tabs? –  BitsOfNix Jul 17 '13 at 8:48
    
Yes I wan to convert the file data into HTML table –  s.singh Jul 17 '13 at 9:44
    
Is there any option to convert excel data into html table in mail body ?? –  s.singh Jul 17 '13 at 11:31

1 Answer 1

up vote 0 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.