Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!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: How do i write this macro under VI Message-ID: <1991Apr15.190259.8395@chinet.chi.il.us> Date: 15 Apr 91 19:02:59 GMT References: <1991Apr11.232907.21795@massey.ac.nz> Organization: Chinet - Chicago Public Access UNIX Lines: 26 In article <1991Apr11.232907.21795@massey.ac.nz> R.Singh@massey.ac.nz (R. Singh) writes: >A couple of macros, I wanted advice on >1) Go to the beginning of every line and delete the first 25 characters. :%s/^.........................// [Note: I would probably type the above line into the edit buffer using i:%s/25A.A// instead of counting the .'s, then delete to a named register and execute with "add@a Besides saving the counting, this method lets you undo the change, yank back the command and modify it if it turns out to be wrong.] >2) Find a particular pattern and delete to a particulate pattern >for example if you have lines like >-a info-mac/app/00app-abstracts.abs >-a info-mac/apple/00apple-abstracts.abs >and want >-a 00app-abstracts.abs >-a 00apple-abstracts.abs >meaning in every line of the file, delete from info-mac to 00. :%s/info-mac.*00/00/ Les Mikesell les@chinet.chi.il.us