Using sed
:
sed '/\/\*.*\*\// d; /\/\*/,/\*\// d' file
The command d
tells sed to delete patterns matching the preceeding expression. The first expression /\/\*.*\*\//
matches one-line comments, the second one /\/\*/,/\*\//
comments that range multiple lines (this is implied by the ,
).
I don't know if this works 100%, but as far as I tried, it did the job.