Substitute Syntax???

k2gremlin

Distinguished
Oct 9, 2006
232
0
18,680
Sup all..

I have a web album on my server and I am trying to take a hyperlink off all the image pages...

This is the original code..
[cpp]<a href="target920.html">Last</a> | <a href="index.html">Thumbnails</a> | <a href="http://germany08.myftp.org/">Home</a><br>

</span><hr size="1">
[/cpp]

I am trying to take off the [cpp]| <a href="http://germany08.myftp.org/">Home</a><br>[/cpp]
Portion and replace with a simple
[cpp]<br>[/cpp].

The command I am using is..

[cpp]perl -pi~ -e 's/| <a href="http:"\"/"\"/germany08.myftp.org"\"/">Home<"\"/a><br>/<br>/' target1.html[/cpp]

Edit: Edit: Dont mind the "" around the \ .... when I entered the \ in the code it was taking them out.. so disregard the ""'s around the \'s

When I run that code I get this as my output in the file..tons of <br> on everyline...

[cpp]<br><a href="target2.html">Next Picture</a> |
<br>
<br><a href="target920.html">Last</a> | <a href="index.html">Thumbnails</a> | <a href="http://germany08.myftp.org/">Home</a><br>
<br>
<br></span><hr size="1">
<br>
<br>
<br>
[/cpp]

Any ideas? As you can see its even tossing an <br> between the 2 original lines of code and its not even taking out the link...
 

linux_0

Splendid
Oh yeah, it works :)

[user@localhost ~]$ perl -pi -e 's/\| <a href="http:\/\/germany08.myftp.org\/">Home<\/a><br>/<br>/; ' < test.html
<a href="target920.html">Last</a> | <a href="index.html">Thumbnails</a> <br>