Comment and uncomment the multiple lines in vi editor linux
1. For comment the multiple lines :-
Suppose we need to comment the lines from 6th line to 20th line in vi text editor using below syntax in vieditor.
from 6 line to 20line
type ESC in vi editor
:6,20s/^/#/
Here ^ indicates starting of the line. So We replaced starting of line with '#' means comment the line.
2. For uncomment the multiple lines :-
from 6th line to 20th line
type ESC in vi editor
:6,20s/^#//
From above one line started with # will be removed, line uncommented
No comments:
Post a Comment