On Thu, 19 Apr 2001, Geof Steichen wrote:

> I discovered, using the hex editor, that the scripts on the cdrom from
> "Linux Shells by Example" terminate each line with a carrage return
> followed by a line feed (hex 0d0a) combination.  The lines of the
> identical script entered using vi terminates each line with just the
> line feed (hex 0a).  The script entered using vi runs from the
> command line by entering just the scriptname.  The scripts from the
> cdrom (lines terminated by CR/LF) do not run from the command line
> directly.  They do not run correctly even if invoked by saying "bash
> scriptname".
> 
> How can I strip the CR (hex 0d) from the lines in the scripts from
> the cdrom.  Can gawk do it?  It seems possible to process the file
> and strip the CR characters out piping stdout to a file on the
> harddisk.  Can someone show me how?
> Thanks in advance.
> 
>  --  
> Geof A. Steichen
> Mandrake 7.1 Linux
> [EMAIL PROTECTED]
> 
I use an alias in TC shell like so:

    tr -d '\015' < \!:1 > \!:2

Called from the command line for instance like this:

    cleanlines oldfile newfile

This simply deletes all the ASCII 0xd characters.

You could use the transform command directly:

    tr -d '\015' < oldfile > newfile

------------------------------------- 
Len Lawrence @ The Thistle Foundation







Reply via email to