Reputation: 1477
i have a code like this:
<html>
<body>
<div>some normal html code</div>
<!--f1930e-->
some javascript code goes here...
<!--/f1930e-->
some other html....
</body>
</html>
how do i remove the part of:
<!--f1930e-->
some javascript code goes here...
<!--/f1930e-->
so that it become:
<html>
<body>
<div>some normal html code</div>
some other html....
</body>
</html>
my command is like this:
grep -lr -e 'f1930e' * | xargs sed -e 's/<!--f1930e-->.*<!--\/f1930e-->//'
that is not working.
Upvotes: 0
Views: 55
Reputation: 185171
Try this in your shell :
$ sed '/<!--f1930e-->/,/<!--\/f1930e-->/d' file.html
<html>
<body>
<div>some normal html code</div>
some other html....
</body>
</html>
If you want to really modify the file, add the -i
switch to sed.
Upvotes: 1