Article View: comp.editors
Article #3423Re: question about "vi"
From: David Gotwisner
Date: Sat, 11 Feb 1989 11:45
Date: Sat, 11 Feb 1989 11:45
39 lines
1721 bytes
1721 bytes
In article <740@bnlux0.bnl.gov>, como@bnl-max (Andrew T. Como) writes: # # I have a question about vi. # # Here are five lines: # The cow jumped over the moon # The cow jumped over the moon # The cow jumped over the moon # The cow jumped over the moon # The cow jumped over the moon # # How can I substitute /cow/dog only on lines 1 and 5 # # I guess what I'm asking is if I # search for cow - /cow/ # now substitute - s/cow/dog/ # skip the next 3 lines n n n # ...how can I re-issue the same substitution when I come to line 5 # If you use :s/cow/dog in the first place, go to the next line wanting changing and type :~ If you change the first one using cwdog<esc> or cedog<esc>, go to the next line wanting changing and type . (that's right, just a period). A third way is to type :g/cow/s//dog/c (c for confirm). Vi will type the line, with ^^^^ under it. Type a y<return> to change it, type <return> or n<return> to not change it. Similarly, you could have typed :1,5s/cow/dog/c, or some other flavor of the same. There are probably at least 100 other ways of doing it. :-) -- ------------------------------------------------------------------------------ Dave Gotwisner UUCP: ...!unisoft!peritek!dig Peritek Corporation ...!vsi1!peritek!dig 5550 Redwood Road Oakland, CA 94619 Phone: 1-415-531-6500
Technical Details
Message-ID:
<397@peritek.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-lcc!unisoft!peritek!digReferences:
<740@bnlux0.bnl.gov>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-lcc!unisoft!peritek!dig From: dig@peritek.UUCP (David Gotwisner) Newsgroups: comp.editors Subject: Re: question about "vi" Message-ID: <397@peritek.UUCP> Date: 11 Feb 89 11:45:19 GMT References: <740@bnlux0.bnl.gov> Organization: Peritek Corp., Oakland, CA Lines: 39