Substitute Syntax???

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...
2 answers Last reply
More about substitute syntax
  1. Try perl -pi -e 's/\| <a href="http:\/\/germany08.myftp.org\/">Home<\/a><br>/<br>/; ' < test.html

    You have to escape | and other special chars.

    Good Luck :)
  2. 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>
Ask a new question

Read More

HTML Command Prompt Servers