D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] More scripting silliness...



On Wednesday 02 Jul 2003 10:46 pm, Simon Waters wrote:
> Jonathan Melhuish wrote:
> > What I really need is a script to just take the "sms.ic" bit out of
> the search
> > 'URLs' so that the links on the static page point to another static page,
> > that's a much easier fix!
>
> Maybe I have wrong end of stick, but Apache could do that when the link
> is followed I think, failing that the Perl sites are full of examples of
> how easy it is to use Perl to do the things sed was designed for ;-)

#!/usr/bin/perl
my $url;
$url =~ s$http://www.smssat.biz/$../$;

This swaps the first occurrence of the qualified domain http://www.smssat.biz/ 
in the string $url for a relative link (in this case, the parent directory 
above the script location).

The use of $ as the delimiter in this case makes for a whole lot less hassle.


-- 

Neil Williams
=============
http://www.codehelp.co.uk
http://www.dclug.org.uk

http://www.wewantbroadband.co.uk/

Attachment: pgp00011.pgp
Description: signature


Lynx friendly