Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!cs.uoregon.edu!ogicse!intelhf!ichips!iwarp.intel.com!gargoyle!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.editors Subject: Re: VI question Message-ID: <1991Apr18.164541.14649@chinet.chi.il.us> Date: 18 Apr 91 16:45:41 GMT References: <1991Apr16.234809.23553@massey.ac.nz> Organization: Chinet - Chicago Public Access UNIX Lines: 19 In article <1991Apr16.234809.23553@massey.ac.nz> R.Singh@massey.ac.nz (R. Singh) writes: >Get VI to recognize a pattern of two 4 lettered uppercase words and insert >a comma in them > >XHLP XCEL =>XHLP,XCEL >In the above case it is easy, but I want a command which will do it for a >pattern like this anywhere in the file. :%s/\<\([A-Z][A-Z][A-Z][A-Z]\) \([A-Z][A-Z][A-Z][A-Z]\)\>/\1,\2/ This assumes that there is always a single space between the words which you want to change into a comma. If not, you would need to replace the space above with something to match whatever might be there. If you do a lot of this, you might want to put the ex commands in a file and :source them. Les Mikesell les@chinet.chi.il.us