Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!mcsun!ukc!cf-cm!bharat From: bharat@computing-maths.cardiff.ac.uk (Bharat Mediratta) Newsgroups: comp.editors Subject: Re: Simple VI question? Message-ID: <1991May9.130749.10301@cm.cf.ac.uk> Date: 9 May 91 13:07:49 GMT References: <1991May9.024022.24367@massey.ac.nz> Sender: news@cm.cf.ac.uk (USENET News System) Organization: University of Wales College of Cardiff Lines: 32 In article <1991May9.024022.24367@massey.ac.nz> R.Singh@massey.ac.nz (R. Singh) writes: >How does one do this in VI. > >Mark 2 lines, and then from ":'a, 'z" append a >> at the beginning of every >line. For example for whole file, a command of ":g/^./s//la/g" would >substitute the first 2 characters of every line with la. This actually replaces only the first character on each line with 'la' To replace both: :g/^../s//la/g or more simply: :%s/^../la/g > >What I want to do is insert >> before every line in the region marked with >"ma" and "mz". Mark the two lines with 'ma' and 'mz' and then type: :'a,'z s/^/>>/ Cheers! -- | Bharat Mediratta | JANET: bharat@cm.cf.ac.uk | +--------------------+ UUNET: bharat%cm.cf.ac.uk%cunyvm.cuny.edu@uunet.uucp | |On a clear disk... | uk.co: bharat%cm.cf.ac.uk%cunyvm.cuny.edu%uunet.uucp@ukc| |you can seek forever| UUCP: ...!uunet!cunym.cuny.edu!cm.cf.ac.uk!bharat |