Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!dg!mrx!carlson From: carlson@mrx.webo.dg.com (James Carlson) Newsgroups: comp.editors Subject: Re: Substituting on even or odd line numbers in VI? Message-ID: <1376@dg.dg.com> Date: 26 Jun 91 19:18:01 GMT References: <1991Jun26.025626.29367@massey.ac.nz> <3706@wn1.sci.kun.nl> Sender: root@dg.dg.com Reply-To: carlson@mrx.webo.dg.com Organization: Data General Corporation, Westborough, MA Lines: 28 > :2,$g/^/s/foo/bar/g|+t+|-d Wow! That's as clear as mud! For reference, executing: select +1 repeat * In KEDIT (or XEDIT) will select for editing all of the even lines. You can then execute any commands against this subset (including block mark/copy/move/delete and global search/replace). To return to viewing and editing the whole file, enter: all (To get 2 out of every three, do "1 select +1" instead. To reverse the selection (to 1 out of 3 or to the odd lines in the previous example) use: display 1 Since all that the 'select' command really does is tag each line (default 0) with a level number, you can switch back and forth between the displayed and undisplayed lines with a single command. For humor value, you could bind this to a key ...) -- Disclaimer: I cannot speak for Data General. You should have guessed that. Mail to: carlson@mrx.webo.dg.com -or- James_Carlson@dgc.mceo.dg.com .//.