How to convert the data into excel sheet and send mail using 'mailx' command

Hi all
I have a shell script that uses a stored proc to generate output from some tables and send the same in an e-mail using mailx command. Now I need to convert the output to excel format and send e-mail. How can I achieve this. Please help me in this regard, as it's very urgent and I have been scratching my head on this for almost 5 days.:confused:

Thanks
Sanbabu

Set your write commands, or modify the existing file to put comma's between each field. Also, save the file with a .csv extension. Excel will naturally open a .csv file.

Hi Joeyg

Thanks for the reply but the stored proc is not generating any file, it's just a report that is directly mailed using mailx command. I want to create an excel file with that output and mail the same using mailx command.

any thoughts on this

thanks
sanbabu

The answer would depend on the format of the generated file. Can you post a couple of lines, along with how you would want those lines to look in the final file?

And, as long as you're simulating DNA, can you figure out how to give me a third arm? I'd really like a hand I could dedicate full-time to mousing. Right now, it offends me to have to move my hand from the keyboard to the mouse...

right now it's like this

from: bab@gsl.com
to: tew@gsl.com
subject: policy status report for 10392

coverage date last name first name
XXXXXXXXX XXXXXXXX XXXXXXXXXXXXX

I want the output completely exported to an excel and send the same thru an attachement.

thanks
sanbabu

As was mentioned before, the .csv format might be your best bet. It's very well-recognized by Excel, and virtually every other spreadsheet app. So, I'm going to assume that the "coverage date last..." line is a header line. You should be able to use awk to convert to a .csv. Let's suppose that you have file that's just called "data.file". You can do:

awk '{print $1","$2","$3}' data.file >> datafile.csv

I'd suggest running the file through that and seeing if that gives you what you need. A little of the actual file might help in order to account for any gotchas-- spaces used inside fields, etc.