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


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to convert the data into excel sheet and send mail using 'mailx' command
# 1  
Old 10-14-2008
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.Smilie

Thanks
Sanbabu
# 2  
Old 10-14-2008
Hammer & Screwdriver Investigate writing the file as .csv

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.
# 3  
Old 10-14-2008
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
# 4  
Old 10-14-2008
Quote:
Originally Posted by sanbabu
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.
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...
# 5  
Old 10-14-2008
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
# 6  
Old 10-14-2008
Quote:
Originally Posted by sanbabu
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.
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:

Code:
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to convert text file into Excel sheet

:cool:Hi, Iam new to this Scripts and forum too. Plz excuse if may i ask silly questions now and further.. Prob: i need to convert txt files data into excel sheet. Suppose if i have hour-wise data in txt file1 and file2 like file1 file2 00: 140 00: 235 01: 160 01:415... (1 Reply)
Discussion started by: mrudula
1 Replies

2. Shell Programming and Scripting

Summing up the data from different excel sheet into one excel sheet

Hi Folks, Can you please advise for any script in unix such that for example , i have 3 different excel sheet at the location /ppt/gfr/exc so the name s of the excel sheet are 1excel.xslx 2excel.xslx 3excel.xslx now in these 3 different excel sheet there is lot of data for example each... (3 Replies)
Discussion started by: punpun66
3 Replies

3. UNIX for Dummies Questions & Answers

Load UNIX data into excel sheet

Hi, i have some data in a temporary file in Unix (the data is taken from the result of an SQL query). Now i want to dump that data into an excel sheet. How to do that. Someone please advise. Thanks Regards, Vinit (3 Replies)
Discussion started by: vinit raj
3 Replies

4. Shell Programming and Scripting

Not able to send the mail using mail and mailx command

Hi All, I am trying to send a mail from linux server but could'nt able to send the mail. I tried the below syntax's so far but no luck. mail -s “Hello world” abc@xyz.com < /usr/g/txt.log cat "txt.log" | mailx -s "Hello world" abc@xyz.com mailx -s “Hello world” abc@xyz.com <... (2 Replies)
Discussion started by: scriptscript
2 Replies

5. Shell Programming and Scripting

Mailx command - send mail as table format

I have to send a couple of rows that have been returned from a SQL query. I have written the output of the query to a file and while i try to print this in the mail body the formatting goes wrong. Intended Output in mail body: Col1 Col2 Col3 ------ ... (2 Replies)
Discussion started by: qwertyu
2 Replies

6. Shell Programming and Scripting

Perl : not capturing all the data from excel sheet

Hi folks, I am working on assignment that captures all the records(2 columns one column contains names and other contain date of birth) from excel sheet stored in a directory and checks for current date and month. If it matches current date and month then the matched records are printed as... (1 Reply)
Discussion started by: giridhar276
1 Replies

7. Shell Programming and Scripting

mail a csv file as an excel sheet!

Hi, The result of a script is a csv file in the following format: cat $file_name DATA_USAGE_FACT,YES_NO_FLG,TARGET_TABLE,YES_NO_FLG,1,0,15,0 DATA_USAGE_FACT,DATE_OF_CREATION,TARGET_TABLE,DATE_OF_CREATION,29,9,19,0 DATA_USAGE_FACT,UPDATION_DATE,TARGET_TABLE,UPDATION_DATE,29,9,19,0... (3 Replies)
Discussion started by: dips_ag
3 Replies

8. UNIX for Dummies Questions & Answers

Unable to send e-mail using mailx command

Hi All, Can you please help me in solving this. I am facing some problem sending mails. If I use like this, I am able to send mail the mail echo "This is an automated e-mail; please do not reply." | mailx -s "Good Morning ." 'abc@xys.com' But if I use like this, then I am unable to send... (1 Reply)
Discussion started by: manas6
1 Replies

9. Shell Programming and Scripting

Problem with Mailx command to send mail with attachment

Hi, I am using mailx command to send a mail with attachment. It's working fine, but with attachment I am getting one extra attachment like (ATT00131.txt). I have tried to use unix2dos command also. But still I am getting the extra attachment. I am using the following code: subject="temp... (5 Replies)
Discussion started by: viswanatharv
5 Replies

10. UNIX for Advanced & Expert Users

how to read the data from an excel sheet and use those data as variable in the unix c

I have 3 columns in an excel sheet. c1 c2 c3 EIP_ACCOUNT SMALL_TS_01 select A.* from acc; All the above 3 col shoud be passed a variable in the unix code. 1.How to read an excel file 2.How to pass these data as variable to the unic script (1 Reply)
Discussion started by: Anne Grace
1 Replies
Login or Register to Ask a Question