[Wolves] Unix Problem

Alex Willmer alex at moreati.org.uk
Tue May 1 20:51:20 BST 2007


On Tue, 2007-05-01 at 11:11 +0100, Broadfield Robert wrote:
> Hi Folks
>  
> Forgive me for this question being off topic (non-Linux) but I need
> your help.  We currently run some software on an AIX Unix server.
> This software allows us to produce reports that are held on the user's
> spool file.  However, the carriage returns at the end of each line
> aren't put into the reports until they are physically printed out.  I
> know enough to be able to ftp a copy of the spool file to my own
> machine but I'm having to put the carriage returns in by hand.  I have
> put up with this until now because I have only done this for a few
> short reports.  However, today I have to do the same with a quite
> lengthy report (it will most likely take most of the day).
>  
> I may be missing something obvious, but is there a way of manipulating
> the file in Unix so that I don't have to do this?

Apologies if you're aware of this already. Unix (including Linux) &
Windows have different ideas about what starts a new line in a text
file. On Windows, a newline is the two characters CR+LF (Carriage Return
+Linefeed). On Unix a newline is started by the character LF (Linefeed).

On Windows, a text file written on Unix will not be shown with new
lines. Instead every line will be stuck together.

There are ways around this:
     1. Open the text file with Wordpad, save it. Wordpad understands
        Unix newline (LF) and writes Windows newline (CR+LF). Be sure to
        set the format to plain text in the save dialog
     2. Use a text editor such as Scite, which can convert between the 2
        codings. http://scintilla.org
     3. Use tofrodos a package of command line utilities, useful for
        batch conversion.
        http://www.thefreecountry.com/tofrodos/index.shtml
     4. Use more tr or sed, more generalised unix commands.
        http://en.wikipedia.org/wiki/Newline#Conversion_utilities

Alex






More information about the Wolves mailing list