Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 May 1996 10:02:33 -0400 (EDT)
From:      Brian Clapper <bmc@telebase.com>
To:        mcs@vpm.com (Mark Stout)
Cc:        questions@freebsd.org
Subject:   Re: dos2unix for FSB?
Message-ID:  <199605091402.KAA01782@telebase.com.>
In-Reply-To: <61505805@toto.iv>

next in thread | previous in thread | raw e-mail | index | archive | help
Mark Stout wrote:
>
> Is there a port for dos2unix/unix2dos for FSB?  I can't locate anything on
> it, so I'm wondering if others know.

I use two small perl scripts (enclosed); they work fine and don't require
porting.

dos2unix:

   #!/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).

unix2dos:

   #!/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.

----
Brian Clapper .............................................. bmc@telebase.com
http://www.netaxs.com/~bmc/ ............. PGP public key available on request
Half of one, six dozen of the other.



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