Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Sep 1996 11:31:50 -0400
From:      "Gary Chrysler" <tcg@ime.net>
To:        "Randall D. DuCharme" <randyd@nconnect.net>, <questions@FreeBSD.org>
Subject:   Re: MS-DOS text files in UNIX
Message-ID:  <199609241532.LAA22286@ime.net>

next in thread | raw e-mail | index | archive | help

-=-=-=-=-=-=-=-=- CUT unix2dos.pl
#!/usr/bin/perl -pi
#
# Convert Unix text file to DOS file format.  Conversion is done in-place.
#
# Usage: unix2dos unixfile ...
print STDERR "Converting \"$ARGV\" ...\n" if (eof || ($. == 0));
s/$/\015/;                   # tack on ^M
s/\n/\n\032/ if (eof);       # DOS ^Z at end of file.
-=-=-=-=-=-=-=-=- CUT unix2dos.pl

-=-=-=-=-=-=-=-=- CUT dos2unix.pl
#!/usr/bin/perl -pi
#
# Convert DOS text file to Unix file format.  Conversion is done in-place.
#
# Usage: dos2unix dosfile ...
print STDERR "Converting \"$ARGV\" ...\n" if (eof || ($. == 0));
s/\015$//;                   # strip ^M from end of line.
s/\032$//;                   # strip ^Z if we see it (which'll be at EOF).
-=-=-=-=-=-=-=-=- CUT dos2unix.pl

here is a couple of perl scripts that I use!
I forgot who wrote em, I sure do thank em!

-Enjoy
Gary
~~~~~~~~~~~~~~~~
Improve America's Knowledge... Share yours
The Borg... Where minds meet
(207) 929-3848


----------
> From: Randall D. DuCharme <randyd@nconnect.net>
> To: questions@FreeBSD.org
> Subject: MS-DOS text files in UNIX
> Date: Monday, September 23, 1996 11:25 PM
> 
> Greetings,
>    I've read numerous things about adding the CR-LF back into text files
> for use with DOS, but what about the other way?? Is there a way to
> remove
> that annoying ^M from a DOS text file under FBSD?  I've tried many
> things
> but nothing short of removing them one-by-one seems to work.  
> 
> Thanks
> 
> Randy



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609241532.LAA22286>