format help

I am trying to generate a report. The output looks fine in unix file. But, when I email it or mail as an attachment its not sent in proper format....

padding with spaces is also not working... but padding with '.' is working, but doesn't look nice. How can I achieve proper format in email.

From Unix file:

Database  User Name    Profile                       Password Change date                 Status

test_db    USER1            DBA_PROFILE           17-MAR-2005 16:31                     OPEN                                                                                                                  
               USER2            USER_PROFILE         17-MAR-2005 16:30                     OPEN                  
               OPS$ORACLE   DBA_PROFILE                                                            OPEN

From mail:

Database             User Name             Profile      Password Change date      Status

test_db  user1   DBA_PROFILE          17-MAR-2005 16:31 OPEN
      user2       USER_PROFILE    17-MAR-2005 16:30 OPEN
      OPS$ORACLE                   DBA_PROFILE             OPEN                  
Padding with '.'
test_db...  USER1.......  DBA_PROFILE........     17-MAR-2005 16:31 OPEN.....                                                                                                                  
               USER2.......   USER_PROFILE......     17-MAR-2005 16:30 OPEN.....                  
               OPS$ORACLE DBA_PROFILE.......      ...........................  OPEN....

Please advise....

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

    We don't know what tool you are using to produce your report or send the email and whether or not you KNOW what email client your recipient will use.  In sql*plus, it's often a good idea to do the following for text you will capture:

set TAB off
st trimspool on
set trimout on

  But the main issue is the fonts used by your email.  sql*plus uses a monospace font (courier). And many email clients, by default, use proportional fonts where not every character takes up the same space.  Your choices are (and depend on what you can control):

1) Use html
2) Use pdf
3) Use monotype font

Good luck!
csreeniAuthor Commented:

Basically its ignoring spaces... is there any way we can specify the font of email client to be similar to our sql*plus. Its a report from sqlplus.

calling the sqlplus in a shell script and mailing it using mailx. Tried email as content and attachment. No difference in both. Spaces are ignored and blank columns are not properly formatted.....
   Not for mailx.  It's pretty basic.  I assume you're either cat'ing the file or attaching it.  The problem is that it is the READER's email program that controls the display.  Depending on which version of sql*plus you're using you can have your output be written in html, then send that html file as an attachment.  If the user's email program allows them to view html, then they will see the proper format.

Good luck!
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

csreeniAuthor Commented:
We are on 9.2. How can I write the output as html.
    Here's the link to how to use the sql*plus markup options:

It's pretty easy, but it's worth reading the chapter (at least 8-1 and 8-2) to make sure you know what you're getting.

Good luck!
csreeniAuthor Commented:
just a simple unix command solved my problem...

cat "$FILE" | col -x |  mailx -s "User Report" "$EMAIL"

Thanks for your suggestions.

PAQed with points (250) refunded

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.