Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Sep 1997 17:06:11 -0400 (EDT)
From:      Brian Clapper <bmc@WillsCreek.COM>
To:        questions@FreeBSD.ORG
Subject:   Re: dos converters
Message-ID:  <199709212106.RAA10565@current.willscreek.com>
In-Reply-To: <37738251@toto.iv>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Jonathan Fosburgh wrote:

> Hey all,
>
> Is there a unix2dos and dos2unix package for FreeBSD? I looked in the
> packages collection but couldn't see anything like them.  If not
> prepackaged, where might I get it and what else might I need? Thanks.

Enclosed are two simple perl scripts that should do what you want.
I've been using them for years.
-----
Brian Clapper, bmc@WillsCreek.COM, http://WWW.WillsCreek.COM/
As you read the scroll it vanishes,
and you hear maniacal laughter in the distance.


[-- Attachment #2 --]
#!/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.


[-- Attachment #3 --]
#!/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).
help

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