SUSE Support

Here When You Need Us

How to convert Carriage Returns to Line Feeds and vice versa

This document (3526475) is provided subject to the disclaimer at the end of this document.

Environment


SUSE Linux Enterprise Desktop 10
SUSE Linux Enterprise Server 10
 

Situation

The print job is not formated correctly when printing.

 

Resolution

It is an unfortunate fact of life in the computing industry that the most common computing platforms store text files in subtly different ways. Unix systems use a simple linefeed (Ascii 10), Macintosh Systems use a carriage return (Ascii 13) and Windows/Dos systems use a carriage return AND a linefeed (13, 10). Mostly this difference causes no problems - but occasionally these differences can be enough of a problem to make life difficult. There are two utilities to help convert from one format to another. I have outlined how to use them below.


To convert a file from UNIX to DOS format do the following steps:
1. Open a terminal and type "su" and then when prompted enter the root password.
2. Type "unix2dos -k "
3. Print the file by typing "lp -d "

To convert a file from DOS to UNIX format do the following steps:
1. Open a terminal and type "su" and then when prompted enter the root password.
2. Type "dos2unix -k "
3. Print the file by typing "lp -d "

Please note that SLE10 does not have the unix2dos utility included. It will be necessary to obtain the rpm from another source. The unix2dos will not be added to future releases because text file conversion tools like iconv and recode already exist in SLE10. These can perform the same functions as unix2dos and dos2unix.
 
To convert ASCII text that comes from Unix to DOS/Windows do the following steps:
1. Open a terminal and type "su" and then when prompted enter the root password.
2. Type "recode lat1..ibmpc "
3. Print the file by typing "lp -d "
 
To convert ASCII text that comes from DOS/Windows to Unix do the following steps:
1. Open a terminal and type "su" and then when prompted enter the root password.
2. Type "recode ibmpc..lat1 "
3. Print the file by typing "lp -d "
 
Note: The two dots are not a typo, that's just 'recode' syntax.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:3526475
  • Creation Date: 27-Feb-2008
  • Modified Date:04-Mar-2021
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.