regex - Perl one liner to remove comments, removes lines which are not comments also -


i using perl 1 liner remove comments from c file, removes lines have asterik(*) in between words, eg

static void * 

here in 1 liner using:

'perl -0777 -pe ''s{/\*.*?\*/}{}gs'' ' sourcefile ' > ' destfile 

could please suggest?

thanks

this question answered in perlfaq.

"how use regular expression strip c style comments file?"

http://perldoc.perl.org/5.8.9/perlfaq6.html#how-do-i-use-a-regular-expression-to-strip-c-style-comments-from-a-file?


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -