Sunday, January 15, 2006

Vi Editor Tip - How to add a character at the Beginning Lines in a File.

Suppose you want to add # at the Beginning of a Line for 25 lines in a file.

::.,+N s/^/#/g

Where "N" is the Number of lines to be commented after the current cursor location inclusive of the current line.