Transfering unix file as an email attachment

I've written a a script which generates a report file, saved to a unix directory. I need to transfer it, via email, to some users. The command I'm using in my script is:
(note that subject & cur_address are set in the script prior to this line)

cat /u/sandyl/sm_o_commdt_archive/c | uuencode weekly_commiss.doc | mail -s ",subject,cur_address

The file gets emailed and attached correctly, but the problem is that the weekly_commiss.doc is 132 chars wide, so it wraps when I open it in Word. Even if I change the setup to landscape within Word, it still wraps some of the characters.

Is there any way in unix to either change the font size smaller, or some other formatting, such that when it gets emailed it will already be in the appropriate format for the user to receive it?

Thanks for your help.

Sounds like your original report/file is too wide and you need to format the original report to be smaller. Changing the font size usually will not not help because the font information is not part of the flat ASCII report file.

Here are some possibilites:

(1) You must format the original report to be around 80 chars vs. the large 134 chars (maybe not what you want);

(2) You could convert the ASCII report file to another format that has formatting information, i.e. RTF, PDF, PS or some other format that has font size information and other formatting embedded in the file.

BTW: There are many kinds of freeware UNIX utilities to do this conversion. The conversion process has flags to add the formatting you need. I've even seen/used an crude ASCII to .DOC converter, but I think it was just a beta kludge.

This is an interesting question and I'm very interested to see the different approaches from other forum members. PxT, any ideas?

If your input file is ascii, you can format it using nroff(1) or troff(1).

nroff /u/sandyl/sm_o_commdt_archive/c

Will format the file and display it to the screen so that both left and right margins are evenly adjusted. Of course, you can then pipe it uuencode, or whatever you need to do. nroff defaults to 6.5 inch lines, 11 inch long paper. Read the nroff or troff man pages for more info, but that example should work....let us know if not.


Thank you both for your suggestions - they were very helpful, and eventually led me to a final solution.

Changing the original report while still in Unix was not an option - this particular report is also run by the users from a menu. My task was to get that report emailed to managers on a weekly basis, and it has to be the same report as when they run it themselves.

But I did run with your idea of changing the file type before it was transferred. I ended up using an ".wri" (Windows Write file type). Then, when the user opens their Outlook email message, they find an attached document, perfectly formatted, and they are able to use the windows scroll bars to shift view right & left to see the whole file.

Here's the resulting code line that sends the email message:
cat /u/sandyl/sm_o_commdt_archive/c | uuencode weekly_commiss.wri | mail -s ",subject,cur_address

Thanks again for your suggestions.