I have a file that looks like this:
<VirtualHost *:80>
ServerName Url1
DocumentRoot Url1Dir
</VirtualHost>
<VirtualHost *:80>
ServerName Url2
DocumentRoot Url2Dir
</VirtualHost>
<VirtualHost *:80>
ServerName REMOVE
</VirtualHost>
<VirtualHost *:80>
ServerName Url3
DocumentRoot Url3Dir
</VirtualHost>
Where i want to remove this piece of code (it doesn't change):
<VirtualHost *:80>
ServerName REMOVE
</VirtualHost>
I have tried to find the whole piece of code by using the code below, but it doesn't seem to work.
with open("out.txt", "wt") as fout:
with open("in.txt", "rt") as fin:
for line in fin:
fout.write(line.replace("<VirtualHost *:80>\n ServerName REMOVE\n</VirtualHost>\n", ""))