Friday, November 1, 2019

regex - sed - Include newline in pattern



I am still a noob to shell scripts but am trying hard. Below, is a partially working shell script which is supposed to remove all JS from *.htm documents by matching tags and deleting their enclosed content. E.g. and


will remove the first script tag but will omit the "foo" and closing tag which I don't want.




Is there a way to match new-line characters in my regular expression? Or if sed is not appropriate, is there anything else I can use?


Answer



Assuming that you have
foo



the following should work:



sed '/

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...