Monday, March 10, 2008

Sending Linux Text to MS Windows

A README file was being prepared as part of a CDROM for OpenOffice.org installation on MS Windows. I used K3B to burn the CDROM. However, when the CDROM was open in MS Windows, the text appears in one continuous line. This is a common problem for text between Unix and DOS (or MS Windows). The DOS requires an additional return character and the Linux did not cater for this.

To resolve this, install unix2dos. In Ubuntu this is found in tofrodos package.

$ sudo apt-get install tofrodos

Convert using the command line.

$ unix2dos filename.txt

Gedit. Some text documents are created with Gedit. Gedit can be used to edit text and call the Unix2DOS command. This allows text that is nicely formatted when seen in MS Windows.
  1. On a Linux, open Gedit and choose Edit ->Preferences. Click Plugins tab and check the External Tools
  2. Click Configure Plugin, click New.
  3. Enter the name Unix2DOS. Fill the following values:
    1. Description: Tools to make text readable in MS Windows
    2. Command: unix2dos
    3. Input: Current Document
    4. Output: Replace Current Document
    5. Click Close. Close the Gedit
  4. Open the text document to be used in MS Windows. Choose Tools ->Unix2DOS
  5. Save the document. It is now in a format that can be read in MS Windows.

No comments: