A question on .exrc while using vi

WU SHI-KUEI skwu at boulder.Colorado.EDU
Sun Dec 9 14:36:41 AEST 1990


In article <q5LoT4w163w at mudos.ann-arbor.mi.us> mju at 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 <<Frobozz
>1,$g/the/s//an/g
>w
>q
>Frobozz

... more stuff deleted

>--
>Marc Unangst               |
>mju at 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.



More information about the Comp.unix.questions mailing list