Xref: utzoo comp.unix.misc:694 comp.unix.questions:27459
Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!ncar!boulder!uswat!csn!news
From: skwu@boulder.Colorado.EDU (WU SHI-KUEI)
Newsgroups: comp.unix.misc,comp.unix.questions
Subject: Re: A question on .exrc while using vi
Keywords: exrc vi
Message-ID: <1990Dec9.033641.9731@csn.org>
Date: 9 Dec 90 03:36:41 GMT
References: <5315@graphite20.UUCP> 
Sender: news@csn.org
Reply-To: skwu@spot.Colorado.EDU (WU SHI-KUEI)
Organization: University of Colorado, Boulder
Lines: 32
Nntp-Posting-Host: spot.colorado.edu

In article  mju@mudos.ann-arbor.mi.us (Marc Unangst) writes:
..other stuff

>> 	The goal:
>> 	All I am trying to do is replace the 'the's by 'an's.
>> 	That's all.
>
>Son, vi is the wrong tool for the job.
>
>ed file <1,$g/the/s//an/g
>w
>q
>Frobozz

... more stuff deleted

>--
>Marc Unangst               |
>mju@mudos.ann-arbor.mi.us  | "Bus error: passengers dumped"
>...!umich!leebai!mudos!mju | 

Sonny boy, it ain't all that easy - your solution changes all instances of
'theatre' to 'anatre', 'gather' to 'gaanr', etc., etc.  It takes three commands
in 'ed' or 'sed' to accomplish the original task:

	g/^the /s//an/g
	g/ the /s//an/g
	g/ the$/s//an/g

If the 'the's may be preceded or followed by tabs as well as spaces, things
may be even more complicated.