Friday 1 November 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 '/

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...