ECN No Name Newsletter: September, 1989

The ECN No Name Newsletter is no longer being published. This is an archived issue.

[previous article] [next article]

UNIX-Mac Compatibility: The Big Picture

Mike "typesetter" Moya

In the May 1989 No Name Newsletter, I wrote an article about using UNIX created text files on your Mac...I received several confused user responses. ( me!?! confuse users!! impossible!) Therefore, I am once again going to write about using UNIX created files on your Mac with your favorite word processor.

Have you ever wanted to take a paper written using your favorite UNIX editor (Vi, Ex or Edit) or a troff/nroff/eqn/etc UNIX file and be able to format it with your favorite Macintosh word processor (MacWrite, Microsoft Word, etc.). I know you have...I get asked about it every week (one user wanted to be able to use his Mac Microsoft Word from a Sun Workstation...No, I'm sorry, this is a little too much...). Using UNIX files on a Mac is very easy to do. Basically you need to be able to make the UNIX file plain text without a lot of hard labor and serious aggravation.

UNIX to Mac

The first thing you need to do is recognize what *kind* of file you wish to take to your Mac: plain text or troff (or nroff). By plain text I mean just words typed into a file:

  This is just a plain file.
  there is no format or style.
  There are no font changes
  or indentations or anything...
  just words typed into a file

and if you don't know what troff or nroff is then it won't matter to you anyway.

If the file is just plain text, then you are home free! All you need to do is ftp the file from your UNIX directory to the desktop of your Mac! What is "ftp" you say, well...you probably ought to read the Using MacIP on page 14 or type "help ecnnews" then pick "NEWSLETTERS" to read the online copy of the May 1989 NNN article Using NCSA Telnet. (I'm not going to explain it here...again.)

If the file has troff or nroff commands embedded in the text, you'll need to get rid of all the troff/nroff code within the file; thereby, making it into a plain text file. Mac's do not understand troff/nroff..that is a UNIX package. So now you have to go through each line of your text and remove everything that is an troff/nroff command...right? WRONG! That would not only be tedious and tiresome, but down-right annoying. There is a UNIX utility that will remove all of those nasty troff/nroff commands for you, it is called deroff. Here is a bit of information from the system man pages, read it online by typing "help deroff".

NAME
deroff - remove nroff, troff, tbl and eqn constructs
SYNOPSIS
deroff [ -w ] filename ...
OPTIONS
-w Generate a word list, one word per line. A `word' is a string of letters, digits, and apostrophes, beginning with a letter; apostrophes are removed. All other characters are ignored.

All *you* have to do is type "deroff troff.file > plain.text". The result will be your original troff.file unchanged and a new plain.text file with the troff/nroff commands stripped out.

You must realize that all your eqn and tbl stuff is also gone....you must remake your tables and equations with a Macintosh package. There are other things *you* can do. I made myself a shell script that removes all of the leading blanks in a line and any consecutive blank lines (ex. if there are three blank lines in a row, it removes two of them) throughout the file. This allows *me* to do all of the margins, tabs, centering, spacing, etc. from within the Mac word processor. Now just ftp the file from your UNIX directory to the desktop of your Mac.

With this done you are ready for the Mac to come into the picture.

Mac to UNIX

Now, lets say you have this wonderful Microsoft Word file on your Mac and want to take it to your UNIX account and set it up with troff/nroff (why you would want to do this...I don't know, but I get asked about it all the time). The first thing you must check is to see if your Mac word processor will save your file as a TEXT file.

             Microsoft Word & MacWrite screens shown

Notice all the different ways you can save a Microsoft Word document...MacWrite is much more basic, *most* Mac word processors have this ability to save the file as TEXT. You must have this feature to transfer your file back to UNIX successfully. Otherwise when you ftp your Mac file to the UNIX host, you will end up with a file of garbage (remember that Mac files and UNIX files are NOT the same type of format). So go into your editor and save the file you wish to transfer as TEXT. Now ftp your file over to the UNIX machine (using NCSA Telnet, MacIP, or equivalent as discussed earlier). What you will get is a usable file on the UNIX side. "Vi" into the file and do what you please...

If you have any more questions, ask your site specialist or send me e-mail (login: moyman).


webmaster@ecn.purdue.edu
Last modified: Wednesday, 29-Oct-97 16:42:18 EST

[HTML Check] HTML