bykedog
06-18-2003, 12:45 PM
Hello,
I am trying to replace a large number of links in several webpages. The idea is to change this:(Examples are all one line, no CR)<a href="http://www.firstgov.gov/" class="smalltext"> to this:<a href="javascript:openScript('/redirect.php?
redirect=http://www.firstgov.gov/',650,450)" class="smalltext"> I came up with this:sed -e "s/href\=\"\(http.*\)\"/href=\"javascript\:openScript\(\'\/redirect\.php\?
redirect=\1\'\,650\,450\)\"/g" page4.php.old > page4.php.new This only works when the line in the page is:<a class="smalltext" href="http://www.firstgov.gov/"> otherwise I get:<a href="javascript:openScript('/redirect.php?redirect
=http://www.firstgov.gov" class="smallesttext',650,450)"> So how to I tell sed to make the grouping between the first set of matching quotes, not the first and last quote on the line?
thanks in advance
I am trying to replace a large number of links in several webpages. The idea is to change this:(Examples are all one line, no CR)<a href="http://www.firstgov.gov/" class="smalltext"> to this:<a href="javascript:openScript('/redirect.php?
redirect=http://www.firstgov.gov/',650,450)" class="smalltext"> I came up with this:sed -e "s/href\=\"\(http.*\)\"/href=\"javascript\:openScript\(\'\/redirect\.php\?
redirect=\1\'\,650\,450\)\"/g" page4.php.old > page4.php.new This only works when the line in the page is:<a class="smalltext" href="http://www.firstgov.gov/"> otherwise I get:<a href="javascript:openScript('/redirect.php?redirect
=http://www.firstgov.gov" class="smallesttext',650,450)"> So how to I tell sed to make the grouping between the first set of matching quotes, not the first and last quote on the line?
thanks in advance