Wednesday, October 20, 2010

Remove XML Comments with sed

This should work for HTML also:
sed '/<!--/,/-->/d' /target/file.xml
Use sed -i save the changes back into the file.

2 comments:

  1. Lol that does not work it's a train check, I think I'll just try Perl for this. it doesn't help that sed behaves differently on Linux vs Mac, whereas Perl is Perl... same goes for Python

    ReplyDelete
  2. Just tried it again. Worked great... On Linux. The moral of the story is: Don't use a Mac.

    ReplyDelete