[Logwatch-Devel] Logwatch mirror

Mike Tremaine mgt at stellarcore.net
Wed Jan 3 13:45:27 MST 2007


Hugo van der Kooij wrote:
> On Wed, 3 Jan 2007, Mike Tremaine wrote:
> 
>> /usr/bin/perl -pi -e
>> 's%ftp://ftp.kaybee.org/(pub/redhat/.+rpm)%http://www.stellarcore.net/logwatch/$1%g'
>> tabs/download/index.html
> 
> I am rather sure this one got lost in the transmission. If I try something 
> similar I get:
> 
> Bareword found where operator expected at -e line 1, near 
> "s%ftp://ftp.kaybee.org/(pub/redhat/.+rpm)%http://logwatch.vanderkooij.org/$1%gtabs"
> syntax error at -e line 1, near 
> "s%ftp://ftp.kaybee.org/(pub/redhat/.+rpm)%http://logwatch.vanderkooij.org/$1%gtabs"
> Execution of -e aborted due to compilation errors.
> 
> Hugo.
> 

You can grab it directly from here.

http://www.stellarcore.net/downloads/logwatch_mirror.sh

the syntax for inline perl regexs is

perl -pi -e "s/MATCH_STRING/NEW_STRING/g" target_file

So this was using % instead of / so I didn't have to escape everything and the 
target was the index file in tabs/download/index.html

/usr/bin/perl -pi -e \
's%ftp://ftp.kaybee.org/(pub/redhat/.+rpm)%http://www.stellarcore.net/logwatch/$1%g'\
  tabs/download/index.html

-Mike


More information about the Logwatch-Devel mailing list