Home arrow Wiki arrow How to comment all lines in VI editor ?
Main Menu
Home
Help Docs
Newbies
Corporates
Gnu/Linux Distros
Programming
Databases
Links
Search
Regular
News
Interviews
Aaj Ka Tip
Aaj Ka Command
Community
Blogs
Wiki
Forums
Services
Free Software

How to comment all lines in VI editor ? Print E-mail
How to comment all lines in VI editor ?

This can be done with a using a command like 'search and replace'

1.Open the file in 'vi' editor.
2.Press Escape and type :1,$s/^/##/g
3.Press Enter

1,$s/^/##/g can be broken down as
1: To start from 1st line
$s :To end at the last line
/^ : Search for the start of the line
/##:Replace with ##
/g: Replace all occurrences

contributed by : Pratik Shah
< Previous   Next >



gnulinuxclub
Join Us
About Us
Contact Us
Support Us
Acknowlegdement
Login(only for dev.)

Royalty Free Images

O'Reilly User Group discount!




Powered By GIMP GIMP
Contact Webmaster Copyleft 2011 gnulinuxclub.org