I want to remove script calls from the HTML with following script.
var=$(sed -e '/^<script.*</script>$/d' -e '/.js/!d' testFile.html)
sed -i -e "/$var/d" testFile.html
Sample input file:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JavaScript</title>
<script type="text/javascript" src="script.js" language="javascript">
</script>
<script>
// script code
</script>
</head>
<body>
</body>
</html>
Sample output file:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JavaScript</title>
</script>
<script>
// script code
</script>
</head>
<body>
</body>
</html>
But, it gives the following error..
sed: -e expression #1, char 23: unterminated `s' command
Thanks in advance