Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!emory!hubcap!ncrcae!ncrlnk!ncrstp!npdiss1!mercer From: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) Newsgroups: comp.editors Subject: Re: A question on .exrc while using vi Keywords: exrc vi Message-ID: <775@npdiss1.StPaul.NCR.COM> Date: 13 Dec 90 20:16:09 GMT References: <5315@graphite20.UUCP> <1990Dec9.033641.9731@csn.org> <110105@convex.convex.com> Reply-To: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) Organization: StPaul Lines: 43 In article <110105@convex.convex.com> tchrist@convex.COM (Tom Christiansen) writes: :In article <1990Dec9.033641.9731@csn.org> skwu@spot.Colorado.EDU (WU SHI-KUEI) writes: ::>> The goal: ::>> All I am trying to do is replace the 'the's by 'an's. ::>> That's all. ::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. : :*PLEASE* don't spread misinformation. All it takes is a simple \ in :the expression to take care of those cases. : : %s/\/an/g : :--tom :-- :Tom Christiansen tchrist@convex.com convex!tchrist :"With a kernel dive, all things are possible, but it sure makes it hard : to look at yourself in the mirror the next morning." -me Not on my Tower 650 running SysV R3.2. Ed responds with '?' to the word regular expression. Sed treats any expression '\char' as a replacement for the regular slash. Results were unpredictable. So Wu Shi-Kuei is right by my book (of course, someone should also take into account constructs like 'the', "the", and of course, capitals. Compliance with regular expressions varies greatly ampngst the various editors, awks, and expr's - not to mention lex and regex implementations. What is needed is an ANSI RE Spec. -- Dan Mercer NCR Network Products Division - Network Integration Services Reply-To: mercer@npdiss1.StPaul.NCR.COM (Dan Mercer) "MAN - the only one word oxymoron in the English Language"