I'm trying to strip comments from a CSS file using sed. I'm using macOS, and normalize.css as a test file.
So far, I have this:
sed -E 's,\/\*[^*]*\*+([^/*][^*]*\*+)*\/,,g' < normalize.css > normalize.min.css
This does not work whatsoever; all the comments remain in the resulting normalize.min.css file.
I'm taking the regex from the CSS comments spec.
I've also tried it without substitute:
sed -E '/\/\*[^*]*\*+([^/*][^*]*\*+)*\//d' < normalize.css > normalize.min.css
With no luck.
Any help would be very much appreciated. Thanks!
,is so that you don't need to escape the forward slashes.s,/\*[^*]*\*+([^/*][^*]*\*+)*/,,g. That said, the original appears to work fine for a simple input like/* foo */.sed '\#^/\*#,\#\*/$#d'is the one you are looking for?