I have a C file which I copied from somewhere else, but it has a lot of comments like below:
int matrix[20];
/* generate data */
for (index = 0 ;index < 20; index++)
matrix[index] = index + 1;
/* print original data */
for (index = 0; index < 5 ;index++)
How can I delete all the comments enclosed by /*
and */
. Sometimes, the comments
are consist of 4-5 lines, and i need to delete all those lines.
Basically, I need to delete all text between /*
and */
and even \n
can come in between. Please help me do this using one of sed
, awk
or perl
.