Strip XML comments with sed
Posted Sun, 14 Jan 2007
sed -ne '/<!--/ { :c; /-->/! { N; b c; }; /-->/s/<!--.*-->//g }; /^ *$/!p;'
You might consider stripping blanklines and/or filtering through xmllint
--format to make the xml pretty printed.
sed -ne '/<!--/ { :c; /-->/! { N; b c; }; /-->/s/<!--.*-->//g }; /^ *$/!p;'
You might consider stripping blanklines and/or filtering through xmllint
--format to make the xml pretty printed.
cat $moduleDepsFile \
| sed -ne "/<!--/ { :c; /-->/! { N; b c; }; /-->/s/<!--.*-->//g }; /^ *$/!p;" > $moduleDepsF
ile.stripped
I am using this command to strip xml comments and it appears to work on linux; i tried to port the same code on solaris and the commands fails saying
sed: Label too long: /<\!--/ { :c; /-->/\! { N; b c; }; /-->/s/<\!--.*-->//g }; /^ *$/\!p;
Please help..