Tuesday, September 28, 2010

Vi Adding at begining of Line

For Snmp MIB files to comment many lines is a challenge as we need to insert -- at each line

Command :
Global Insertion at begining each line ^ denotes begining of line
:%s!^!--!
Global Removal from begining of each line
:%s!^--! !

If you have line nos to change lets say from 209 to 461 both including
:209, 461 s!^!--!
:209, 461 s!^--! !