How can I remove all script blocks (including multi-line ones) from html files such as:
<script type="text/javascript">
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();
</script>
I tried things like this with no success:
sed -i -e 's/<script.*\n.*<\/script>//g' 'path/to/file.html'
..."...span>"...
is supposed to be. In any case, this question has already been answered to the OP's satisfaction so, again, there's no point in having them both open. However, there are mechanisms in place for cases where you feel a question has been wrongly closed: i) vote to reopen and ii) bring it up on Unix & Linux Meta.