Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Mar 1999 02:39:46 -0800 (PST)
From:      byron@omix.com (Byron Brummer)
To:        fullermd@futuresouth.com (Matthew D. Fuller)
Cc:        byron@omix.com, zen@buddhist.com, freebsd-doc@FreeBSD.ORG
Subject:   Re: Converting text files
Message-ID:  <199903151039.CAA01162@thrush.omix.com>
In-Reply-To: <19990315040916.G25217@futuresouth.com> from "Matthew D. Fuller" at "Mar 15, 99 04:09:17 am"

next in thread | previous in thread | raw e-mail | index | archive | help
"Matthew D. Fuller" <fullermd@futuresouth.com> wrote:
> On Mon, Mar 15, 1999 at 01:15:11AM -0800, a little birdie told me
> that Byron Brummer remarked
> > 
> > 	One of the reasons for the inclusion of the perl command is that it
> > 	automatically saves a backup file of the original, thus helping to
> > 	prevent disaster.  Another reason is that it gets people a little
> > 	more familiar with perl in general.  The command given in the
> > 	handbook is:
> > 
> > 		perl -i.bak -npe 's/\r\n/\n/g' file
> 
> Hm, maybe it's just me, but I always...
> 
>         cat infile | tr '\r' ' ' > outfile

	Well, TIMTOWTDI, however your version inserts extra spaces that were
	not in the original file.  This is why the tr alternate in the
	handbook uses "tr -d '\r'".  Also, the extra cat is not needed as
	the handbook example shows:

		tr -d '\r' < dos-text-file > unix-file

	Personally, I normally recommend a slightly modified version of the
	perl simply because many people I work with are also on Macs:

		perl -pi.bak -e 's/\r\n|\r/\n/g' file

	Or if you want the call style that the tr example uses, you can use:

		perl -pe 's/\r\n|\r/\n/g' < dos-or-mac-text-file > unix-file


perl -e 'print unpack "u", "82G5S=\"!!;F]T:&5R(%!E<FP\@2&%C:V5R"'

-- 
-Zenin (zenin@archive.rhps.org)                 Your Official ORGy sites!
 The Bawdy Caste      (Fremont, CA)                www.bawdycaste.org
 Barely Legal         (Oakland, CA)                   www.barelylegal.org
 Rocky Horror Archive (Earth, Milky Way)                 www.archive.rhps.org
 RHFC1.1 V!M!P1S2RBL24Y1980 P*B-R+20@H-D+100@W+200@T+5@P?L15@Y1990&1@(7@)!1
 C8@W3@P@& IF&-W&&-N+M1C-! MA2{RO,PQ}M{PQ}C3B15@R15@V1O+++ D?-K1S@C0!O{IS}T5@
 QNA+&+!K+!PW>&H1+! YA25+>16G{m}H{5'7"}L{CA,USA}S{f>ba12^H7k}W=


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




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