Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have a file which has some mail body. and another file that is spooled from sqlplus which is delimited by "|". Now, when i redirect the contents of spooled file to mailbody.txt file. it is perfect but when the mail is composed with the mailbody.txt. The mailbody after mail is sent has changed the formattting of the tabular data format and supressed all the spaces.
How can I preserve the spaces in the mail.
Another thing is how can i check and capture the sql errors like database connectivity and space of the database has exceeded. Becoz i am redirecting the output of all the process to a log file.
Using sqlplus in a scripting environment is pretty ugly. I remember having terrible trouble getting it to tell me if there was an error in a sensible way (i.e. setting $? as I would like). There are some SET commands which can help out, but I don't think I ever found a very satisfactory solution.
In the end I think I tried two approaches:
re-directing all output to a temporary file, greping for error messages of various kinds, and doing some post-processing to neaten up the output
giving up and using Perl/DBI.
Not sure about the tab issue, but it's safe to say the perl/DBI approach will solve that too.
Sorry if that's a bit vague - it's been a while since I used it.
Last edited by matthewg42; 08-11-2008 at 04:37 AM.
Sqlplus spool has given the desired output. But while sending the mail the mail command has changed the mail body format where mailbody was stored in a file.
The command used was :
cat mailbody.txt | mail -s "$mailsubject" $adminmailid
where mailbody.txt contains formatted mailbody which is as follows:
ETL Process Successfully Completed.
Measure Name ,File Name ,File Record Count ,Data Loaded
-------------------- ,-------------------- ,-------------------- ,--------------------
Cost - Actual ,data_vistaar_plant_mfg_actual ,121929 ,96
Field Units on Hand US ,field_units_on_hand_us_actual ,4775263 ,148881
Instrument Cost - Actual ,data_vistaar_plant_mfg_actual ,121929 ,96
List Price ,list_price_actual ,File Not Found ,
Plant Of Manufacture ,data_vistaar_plant_mfg_actual ,121929 ,96
Sales Amount - Actual ,sales_source_actual_ous ,47346 ,251321
Sales Amount - Actual ,sales_source_actual_us ,881847 ,251321
Sales Units - Actual ,sales_source_actual_ous ,47346 ,251321
Sales Units - Actual ,sales_source_actual_us ,881847 ,251321
Total Reserve - Actual ,data_reserve_at_mtg_cost_actual ,16009 ,5375
US Mfg Units on Hand ,us_mfg_units_on_hand_actual ,579525 ,122413
Maybe you could send the file as a MIME attachment, rather than in the message body? I'm a Perl fan, so I'd probably use one of the Perl MIME modules to generate the message, but I'm sure there are command line tools for that sort of thing.
Excel uses tab as the default separator character. It is not clear how you are transferring the file or contents to windows and hence to into Excel (copy/paste, directly opening a saved mail body?).
If you paste text into Excel that doesn't not have tabs, and does not have the proper line terminators, it will paste into a single cell.
I'll repeat my comment from post #6. The mail protocol is not changing the text formatting of your text body. It doesn't convert tabs into spaces, and it doesn't compress spaces into a single space. It must encode upon sending, and decode upon receipt. Any conversion is happening by your mail clients or other mail processing software.
This really is not a mail structure question any longer.