Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpcc01!hpcuhb!hpda!hpcupt1!hprnd!egt From: egt@hprnd.HP.COM (Eric Tausheck) Newsgroups: comp.editors Subject: Re: A vi question Message-ID: <3440002@hprnd.HP.COM> Date: 16 Aug 90 22:08:53 GMT References: <14420003@hp-lsd.COS.HP.COM> Organization: HP Roseville Networks Division Lines: 18 > > I need to do the following in vi. > > ccccoooossss -> cos > > :%s/cc*/c/g > :%s/oo*/o/g > :%s/ss*/s/g > ---------- Wouldn't one of the following be more accurate? :%s/cc*oo*ss*/cos/g :%s/ccccoooossss/cos/g I had the need to do this kind of editing too until I learned about col -b. If what you started with had a bunch of back-spaces between the letters too (as in an nroff or man output), the filter "col -b" does a nice job of getting rid of all this junk for you.