Powered by Invision Power Board


  Reply to this topicStart new topicStart Poll

> Erasing comments from file
am2005
Posted: Apr 29 2005, 03:13 AM
Quote Post


Newbie
*

Group: Members
Posts: 1
Member No.: 958
Joined: 29-April 05



I am wondering how to erase all comments from a c or java source code. I think that there has to be usage of sed but I am unsure how to do it. I also believe that since it is somewhat complicated because I need to look for // (comment) and also /* (comment )*/ anywhere within the file and get rid of it. I am baffled because I can get rid of the comment symbols but not the comments. My main problems are where the comment is on the same line as code and also getting rid of the code between the /* and */. Thanks in advance for any help.

For example,

If there is code like this:

/* ................
......................
......................
.................... */

code
code
code

// ........................
// ........................

I want only:

code
code
code
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | Shells & Scripting | Next Newest »

Topic Options Reply to this topicStart new topicStart Poll

 



[ Script Execution time: 0.2608 ]   [ 12 queries used ]   [ GZIP Enabled ]




Partners: Cambridge Plus :: <Link Available> :: PIC Micro Design, UK :: <Link Available>
Unix Man Pages / Linux Man Pages :: HiFi Forum :: SIP VoIP Phone & Provider Reviews :: UNIX/Linux Forum Archives

More info on advertising on Unix/Linux Forum