On Wed, 25 Oct 2000, Daniel Woods wrote:

> Figured it out ?  That's right, ftp'ing a zip file and unzipping it
> on Linux will retain the Windows end-of-line markers (CR/LF). *nix
> only uses LF (newline).  If you use vi/vim on xx2.pl, you'll see a
> '[dos]' comment in the status line (bottom). If you use 'cat -v xx2.pl',
> you'll see the '^M' at the end. If you compare xx.pl and xx2.pl by using
> 'od =a xx.pl' and 'od -a xx.pl2', you'll see 'cr' in xx2.pl .

Damn! I would never have thought about that ;-) You're good!
> 
> So how do we convert it ?

Simpler than that... you are using perl, so why not use perl to convert
the file? Simply type this:
perl -pi -e "s/\015//g;" *.pl

It will remove those CR's from every file, and even if the file is 100%
correct, you can still run it, it will not damage it.

Jean-Michel


> You could gzip your file, upload to windows, unzip it, download the unzipped
> file, and then ./xx2.pl will work (chmod 711).
> You could go to rpmfind.net and look for dos2unix.rpm (and unix2dos) files.
> However I prefer to do this simple trick
>     [DW] $ tr -d '\r' <xx2.pl >xx2ok.pl
>     [DW] $ chmod 711 xx2ok.pl
>     [DW] $ ./xx2ok.pl
> 
> Moral of the story... if you download zip files onto Linux, be sure to use
>       unzip -a file         # see: man unzip
> Or unzip on windows, and then your ftp program will convert line endings
> on text files.
> 
> Thanks... Dan.
> 
> 
> 


------------------------------------------------------------
Jean-Michel Dault <[EMAIL PROTECTED]>
MandrakeSoft inc, Montreal (Canada)
HTCPCP/1.0 Developper  (http://www.ietf.org/rfc/rfc2324.txt)


Keep in touch with http://mandrakeforum.com: 
Subscribe the "[EMAIL PROTECTED]" mailing list.

Reply via email to