Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!ncar!csn!boulder!tramp.Colorado.EDU!lewis From: lewis@tramp.Colorado.EDU (LEWIS WILLIAM M JR) Newsgroups: comp.editors Subject: Re: How do i write this macro under VI Message-ID: <1991Apr12.151152.10889@colorado.edu> Date: 12 Apr 91 15:11:52 GMT References: <1991Apr11.232907.21795@massey.ac.nz> Sender: news@colorado.edu (The Daily Planet) Organization: University of Colorado, Boulder Lines: 38 Nntp-Posting-Host: tramp.colorado.edu 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. ==> The easiest solutiuon is to use 'cut', niot 'vi': cut -c26- filename ==> One line at a time 'vi' macro: 25|d^ # you'll have to escape the pipe with one or more ^V ==> Every line with an "ex' command: :%s/^.........................// # that's 25 dots >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. ==> Again with 'ex': :%s;^\(-a\) \(.*\)/\(.*)/\(.*)$;\1\4; >Thanx >Raminder Singh ==> your welcome