Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies

Monday, November 28, 2011

How to remove all comments in a file

If you are ever stuck in situation where you want to remove all the comments regardless of what they are in a source file. Here’s a small command that you can issue in VIM. It is for pattern search and replace using regex.
Open the file in VIM then
:g/\/\/.\+/s
Above command will look for anything after including the “//” characters which is basically a comment in C, C++, php and several other languages.

No comments:

Post a Comment