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>
next in thread | previous in thread | raw e-mail | index | archive | help
--uy87A9/GwWXX1WfJOEtrHOPvt0fVDHkx5ht6fsBP Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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. --uy87A9/GwWXX1WfJOEtrHOPvt0fVDHkx5ht6fsBP Content-Type: text/plain Content-Description: unix2dos perl script Content-Disposition: inline; filename="unix2dos" Content-Transfer-Encoding: 7bit #!/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. --uy87A9/GwWXX1WfJOEtrHOPvt0fVDHkx5ht6fsBP Content-Type: text/plain Content-Description: dos2unix perl script Content-Disposition: inline; filename="dos2unix" Content-Transfer-Encoding: 7bit #!/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). --uy87A9/GwWXX1WfJOEtrHOPvt0fVDHkx5ht6fsBP--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709212106.RAA10565>