news@massey.ac.nz (USENET News System) (05/09/91)
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. What I want to do is insert >> before every line in the region marked with "ma" and "mz". Thanx Raminder $ingh
rouben@math16.math.umbc.edu (Rouben Rostamian) (05/09/91)
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. > >What I want to do is insert >> before every line in the region marked with >"ma" and "mz". Try :'a,'zs/^/>>/ I prefer to mark one end of the range, say by m, the go to the other end and do :'m,.s/^/>>/ -- Rouben Rostamian Telephone: (301) 455-2458 Department of Mathematics and Statistics e-mail: University of Maryland Baltimore County bitnet: rostamian@umbc.bitnet Baltimore, MD 21228, U.S.A. internet: rouben@math9.math.umbc.edu
bharat@computing-maths.cardiff.ac.uk (Bharat Mediratta) (05/09/91)
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 |
les@chinet.chi.il.us (Leslie Mikesell) (05/09/91)
In article <1991May9.024022.24367@massey.ac.nz> R.Singh@massey.ac.nz (R. Singh) writes: >Mark 2 lines, and then from ":'a, 'z" append a >> at the beginning of every >line. :'a,'zs/^/>>/ But if I were doing it I probably wouldn't bother with the second mark. Just put the cursor on the ending line for the range and use . to reference it. :'a,.s/^/>>/ Les Mikesell les@chinet.chi.il.us
sanjiv@hoss.unl.edu (Sanjiv K. Bhatia) (05/09/91)
In <1991May9.024022.24367@massey.ac.nz> news@massey.ac.nz (USENET News System) 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. >What I want to do is insert >> before every line in the region marked with >"ma" and "mz". All you need to do is to put a backslash in front of >. Thus, you should have: :'a,'z s/^/\>\>/ >Thanx >Raminder $ingh Sanjiv -- Sanjiv K. Bhatia Department of Computer Science sanjiv@fergvax.unl.edu Ferguson Hall 115 voice: (402)-472-3485 University of Nebraska - Lincoln fax: (402)-472-7767 Lincoln, NE 68588-0115
jmastel@immd4.informatik.uni-erlangen.de (Joachim Astel) (05/10/91)
les@chinet.chi.il.us (Leslie Mikesell) writes: >But if I were doing it I probably wouldn't bother with the second mark. Just >put the cursor on the ending line for the range and use . to reference it. >:'a,.s/^/>>/ You could also omit the '.' and the third slash. Mark the beginning and enter: :'a,s/^/>> -Achim -- # Joachim Astel, Wiesenweg 4, D-W-8566 Leinburg, FR-Germany # Are we not # # dowjones@jattmp.ccs.imp.com + dowjones@jattmp.nbg.sub.org # men? -- We # # achim@dl9ncq.ampr.org [44.130.60.20] + VERBAL: Hey Achim! # are DEVO!! #