I want to remove all external js call from minified html file. However, the following removes if js call is in another line (not works for minified html)
var=$(sed -e '/^<script.*<\/script>$/d' -e '/.js/!d' testFile.html)
grep -v "$var" "testFile.html" | sponge "testFile.html"
Sample input file:
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>JavaScript Ders 2</title> <script type="text/javascript" src="script.js" language="javascript"></script> <script></script> </head><body></body></html>
Sample output file:
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>JavaScript Ders 2</title> <script></script> </head><body></body></html>
Thanks in advance