The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Not able to send email as CC to a ID using Mailx command in HP UX rohit.shetty84 UNIX for Dummies Questions & Answers 1 05-14-2008 04:27 AM
how to read the data from an excel sheet and use those data as variable in the unix c Anne Grace UNIX for Advanced & Expert Users 1 03-03-2008 07:21 AM
Creating Excel Sheet in Hp-UX KVSPRASAD HP-UX 5 02-07-2007 11:16 PM
Insert csv into special sheet of excel Elena UNIX for Advanced & Expert Users 2 02-07-2007 08:11 AM
using mailx to send a log file to my outlook e-mail account simt UNIX for Dummies Questions & Answers 6 09-01-2004 12:25 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-14-2008
sanbabu sanbabu is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 3
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.

Thanks
Sanbabu
  #2 (permalink)  
Old 10-14-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Wink 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 (permalink)  
Old 10-14-2008
sanbabu sanbabu is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 3
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 (permalink)  
Old 10-14-2008
treesloth treesloth is offline
Registered User
  
 

Join Date: Oct 2008
Location: Orem, Utah
Posts: 73
Quote:
Originally Posted by sanbabu View Post
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 (permalink)  
Old 10-14-2008
sanbabu sanbabu is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 3
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 (permalink)  
Old 10-14-2008
treesloth treesloth is offline
Registered User
  
 

Join Date: Oct 2008
Location: Orem, Utah
Posts: 73
Quote:
Originally Posted by sanbabu View Post
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:17 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0