Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!nosc!cod!dberg From: dberg@cod.NOSC.MIL (David I. Berg) Newsgroups: comp.unix.questions Subject: Re: Two vi questions. Keywords: vi Message-ID: <1634@cod.NOSC.MIL> Date: 9 Sep 89 21:33:47 GMT References: <4237@ncar.ucar.edu> <3937@mentor.cc.purdue.edu> <614@jvncf.UUCP> Distribution: usa Organization: Naval Ocean Systems Center, San Diego Lines: 23 In article <614@jvncf.UUCP>, saroff@jvncf.UUCP (Steve Saroff lac00001) writes: > 2) Is there any quick and dirty way of inserting a character(s) say > at the front of lines (e.g. quick commenting out of 20 lines of code) Note that the ^ character is a symbolic variable whose value is the null position in front of the first character of each line (just like $ is the symbolic variable whose value is the null position at the end of each line). If you want to insert a # in front of every line in the file: :%s/^/#/ If you want to comment out the next twenty lines from and including the current line: :.,+20s/^/#/ etc through all the variations on this theme. -- David I. Berg (dberg@nosc.mil) GENISYS Information Systems, Inc., 4250 Pacific Hwy #118, San Diego, CA 92110 MILNET: dberg@nosc.mil UUCP: {akgua decvax dcdwest ucbvax}!sdcsvax!noscvax!dberg