home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!convex!news.utdallas.edu!corpgate!bnrgate!nrcnet0!cunews!torn!csd.unb.ca!morgan.ucs.mun.ca!nstn.ns.ca!dragon.acadiau.ca!880139h
- From: 880139h@dragon.acadiau.ca (Rob Hutten)
- Newsgroups: comp.editors
- Subject: Re: Help required in vi editing
- Message-ID: <1992Jul29.113354.21849@dragon.acadiau.ca>
- Date: 29 Jul 92 11:33:54 GMT
- References: <1992Jul28.164526.6394@menudo.uh.edu>
- Organization: Acadia University
- Lines: 29
-
- hsingh@Turing.chem.uh.edu (Harpreet Singh) writes:
-
- > Is there any way (by macro or otherwise) to do such a thing as
- > find a pattern and operate upon it. For Ex. find a comma and
- > then delete till end of line from that point.
-
- One way to do this is with a macro:
-
- map \d /,^[d$
-
- (enter the ^[ by typing control-V ESC)
-
- Invoke this macro by typing `\d' (without the quotes).
-
- Alternately, you could use a search & replace command such as:
-
- %s/,.*$/
-
- This would delete all occurances of a comma followed by any text up
- until the EOL. To limit the range of this command, replace the leading `%'
- with a range of line numbers, ie:
-
- 20s/,.*$/ - perform command on line 20 only
- 20,50s/,.*$/ - perform command on lines 20 through 50 (incl.)
-
-
- Hope this gives you some ideas.
-
- -Rob
-