Using sed to substitute pattern in html file
I have a series of html files that contain two lines like this:
<body>
<h1>Title</h1><p>
<a href="url">Description</a><br>
I want to replace this text with something else using a bash script. I'm trying
sed -i -r 's/<h1>Title.*?$\/^.*?<br>/Replacement text/1' filename.html
but it is not working. I'm suspecting it is getting stuck on the new line and not knowing how to go around the problem.
Any help appreciated.
I have a series of html files that contain two lines like this:
<body>
<h1>Title</h1><p>
<a href="url">Description</a><br>
I want to replace this text with something else using a bash script. I'm trying
sed -i -r 's/<h1>Title.*?$\/^.*?<br>/Replacement text/1' filename.html
but it is not working. I'm suspecting it is getting stuck on the new line and not knowing how to go around the problem.
Any help appreciated.
No comments:
Post a Comment