[lug] How do I convert a DOS file to a UNIX file?

rm at fabula.de rm at fabula.de
Thu Jun 27 12:42:24 MDT 2002


On Thu, Jun 27, 2002 at 12:24:51PM -0600, Ferdinand Schmid wrote:
> How about dos2unix and unix2dos?  Those utilities do exactly what you want. 
> The conversion actually occurs during the ftp upload.  You could avoid the 
> problem to begin with if you upload in binary mode (type binary in the ftp 
> client).
> 
> Ferdinand

Yeah, but why cure the symptoms if you can cure the cause ? ;-)
The conversion most likely didn't happen during burning but during
ftp-ing. Next time try to switch of ftp's automatic text file conversion
by issuing the 'set type image' command at the ftp prompt - that should
do the trick.

 Ralf Mattes

> Dhruva B. Reddy wrote:
> >Unless I'm mistaken, this is caused by those annoying carriage returns
> >(that ^M crap).  I found a way to do it on the web somewhere and
> >incorporated it into the script below. 
> >
> >---BEGIN SCRIPT---
> >#!/bin/sh
> >
> >echo "Removing M$ carriage returns from $1..."
> >
> >tr < $1 > $2 -d '\r'
> >
> >echo "M$ carriage return free file is $2."
> >---END SCRIPT---
> >
> >This creates a copy of the file sans the carriage returns.  You can then
> >just overwrite the original with the copy.
> >
> >Dhruva
> >
> >On Thu, Jun 27, 2002 at 01:52:52PM -0400, Scott Lockhart soliloquized 
> >thusly:
> >
> >>Folks,
> >>Due to strict DMZ requirements at a particular client,
> >>I am not allowed to ftp UNIX files from one Linux server directly to
> >>another.
> >>Instead, I have to ftp to a general staging area, copy to a Windows 2000
> >>server,
> >>burn a CD-ROM, then mount the CD-ROM on my DMZ'd Linux Server.
> >>Major pain in the a**!
> >>
> >>When I go to edit the file on my destination Linux server,
> >>it is now recognized by "vi" as a DOS file!
> >>I suspect this is being done by the CD-ROM burner as far as setting a
> >>file format.
> >>I have tried specifying an ISO 9660 format for the CD-ROM,
> >>but all this does is mess up the file names to the old 8.3 format,
> >>and the files themselves still get whacked into a DOS filetype.
> >>
> >>How can I convert a file designated as a DOS type, to a UNIX type?
> >>
> >>Thanks in advance,
> >>Scott Lockhart
> >
> >_______________________________________________
> >Web Page:  http://lug.boulder.co.us
> >Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> >Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
> 
> 
> -- 
> Ferdinand Schmid
> Architectural Energy Corporation
> Celebrating 20 Years of Improving Building Energy Performance
> http://www.archenergy.com
> 
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug



More information about the LUG mailing list