This question already has an answer here:
I am trying to write a script that will delete all comments and everything in between inside C files in my current directory. I've been using
sed, and this is what I have so far:
sed -i '/ * [^()] */d' *.c
This works when the comments are on the same line as an asterisk or backslash.
However it doesn't work when there is a commented line without a slash or asterisk.
I know sed goes line by line, I just don't know how to tell it to keep deleting until it sees a