Comment specific lines in VI editor

To Comment specific lines in VI Editor:

syntax:

:x,y s/^/#/g

x,y -> starting and ending line numbers.

^ -> points to line's begning

# -> usual way to comment in vim

Example:

:450,500 s/^/#/g

(or)


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

. is current line

+10 is ten lines from the current.

Comments

Popular posts from this blog

Resolved: DOCKER: Error response from daemon: Could not attach to network / rpc error: code = 7 desc = network not manually attachable.

yum failed 6 times. Cannot continue!

unexpectedly shrunk window (repaired) in dmesg log - TCP Peer