Wouldn't <br><br><\sbody> match <br><br></body> since \s matches any non-whitespace? Granted it would also match any <?body> where ? is any non-whitespace character, but that should not happen often in a html file I write. So the question is why it does not want to match some tag/text cut it and replace?
Here is the script:
perl -pe 's#.*(<div class="Content.*)</div></div></body>#$1#sgi' -i.bak test.html
Here is the test html file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-88
+59-1">
<title>Test</title>
<meta name="generator" content="BBEdit 6.5.2">
</head>
<body>
<div class="Header">
<img src="images/xlogo.gif" alt="" width="612" height="108" border="2"
+ align="middle">
</div>
<div class="Navigation">
<div class="navbox"><a class="nav" href="OSXTips2.html">Home</a>
+</div>
<div class="navbox"><a class="nav">Tips: </a><br>
<a class="nav2" href="bash_shell.html"> • Bash</a> <b
+r>
<a class="nav2" href="beta_tools.html"> • Beta Tools</a>&n
+bsp;<br>
<a class="nav2" href="http://www.savagetranscendental.com/OSX.ht
+ml.htm"> • Color LS</a> <br>
<a class="nav2" href="spl.html"> • Lost Password</a>
+<br>
<a class="nav2" href="ppp.html"> • PPP Setup</a> <br>
<a class="nav2" href="spl.html"> • Password Lock</a>
+<br>
<a class="nav2" href="TCSH.html"> • TCSH Setup</a> <b
+r>
<a class="nav2" href="gimp.html"> • The Gimp</a> <br>
<a class="nav2" href="vnc.html"> • VNC & Xfree86</a>&n
+bsp;<br>
</div>
<div class="navbox"><a class="nav" href="construction.html">Links:&nbs
+p;</a><br>
<a class="nav2" href="http://www.darwinfo.org/"> • Darwinf
+o</a> <br>
<a class="nav2" href="downloads.html"> • Downloads</a>&nbs
+p;<br>
<a class="nav2" href="construction.html"> • Dev. Tools</a>
+ <br>
<a class="nav2" href="http:/www.apple.com/macosx/"> • Mac
+OSX</a> <br>
<a class="nav2" href="http://www.savagetranscendental.com/OSX.ht
+ml"> • More OSX Tips</a> <br>
<a class="nav2" href="http://www.osxfaq.com/"> • OSX Faq</
+a> <br>
</div>
<div class="navbox"><a class="nav" href="construction.html">PDFs: 
+;</a><br>
<a class="nav2" href="osxpdf.html"> • OSX</a> <br>
<a class="nav2" href="netpdf.html"> • Networking</a>
+<br>
<a class="nav2" href="unixpdf.html"> • Unix Tips</a>
+<br>
</div>
</div>
<div class="Content">
11.03.02
<p><img src="images/consbar.gif" width="464" height="41"></p>
<p><b><font size="2">?</font></b>Still working on this page.
If anyone has links for me to add, please email me at the address bel
+ow.</p>
<p>Thanx,</p>
<p>SA</p>
<p>11.03.02</p>
<p><a href="http://member.bcentral.com/cgi-bin/fc/fastcounter-login?21
+64123"><img src="http://fastcounter.bcentral.com/fastcounter?2164123+
+4328253" alt="fastcounter" border="0" width="90" height="16"></a><fon
+t size="2"><br>
</font><a href="http://www.bcentral.com/fastcounter/"><font face="Aria
+l, helvetica" size="1">FastCounter
by bCentral</font></a></p>
<div class="box">
<B>[<U> <a href="http://www.apple.com" title="Apple">Apple</a></U> ] [
+<U> <a href="http://www.apple.com/developer" title="Apple Developer">
+AppleDeveloper</a></U> ] [<U><a href="downloads.html" title="Download
+s"> Downloads</a></U> ]</B> <img src="images/e
+mailp.gif" alt="email" width="44" height="51">
<span style="font-size: 14pt; ">Send all mail To:<span style="mso-spac
+erun: yes"></span></span><a href="mailto:t">
</a><BR>
</div>
</div>
</body>
</html>
Thanks.
SA
:) |