From owner-freebsd-questions Sun Sep 21 14:06:19 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id OAA16766 for questions-outgoing; Sun, 21 Sep 1997 14:06:19 -0700 (PDT) Received: from BIGFUN.vwcom.com (BIGFUN.vwcom.com [151.197.101.21]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id OAA16761 for ; Sun, 21 Sep 1997 14:06:15 -0700 (PDT) Received: from WillsCreek.COM (gw.willscreek.com [151.197.101.46]) by BIGFUN.vwcom.com (8.8.6/8.8.6) with ESMTP id RAA02062 for ; Sun, 21 Sep 1997 17:01:38 -0400 (EDT) Received: from current.willscreek.com (current.willscreek.com [172.16.87.1]) by WillsCreek.COM (8.8.5/8.8.5) with ESMTP id RAA07963; Sun, 21 Sep 1997 17:06:11 -0400 (EDT) Received: (from bmc@localhost) by current.willscreek.com (8.8.5/8.8.5) id RAA10565; Sun, 21 Sep 1997 17:06:11 -0400 (EDT) Date: Sun, 21 Sep 1997 17:06:11 -0400 (EDT) Message-Id: <199709212106.RAA10565@current.willscreek.com> From: Brian Clapper MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="uy87A9/GwWXX1WfJOEtrHOPvt0fVDHkx5ht6fsBP" Content-Transfer-Encoding: 7bit To: questions@FreeBSD.ORG Subject: Re: dos converters In-Reply-To: <37738251@toto.iv> X-Mailer: VM 6.23 under Emacs 19.34.1 Sender: owner-freebsd-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk --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--