#!/usr/bin/perl #proprietary, SR Research Ltd., Dave Stampe <dstampe@psych.toronto.edu> $file = shift ; open (IN,$file) or die "Cannto open $file\n" ; while () { if (/href="(.+)">/) { $url = $1 ; print "$file URL $url\n" ; unless ($url =~ /http:/i or $url =~ /ftp:/i) { $url2 = 'http://' . $url ; s/$url/$url2/ ; } } $text .= $_ ; } close(IN) ; exit ; unless ($url2) { exit ; } open (OUT,">fix.tmp") or die "Cannto open $file\n" ; print OUT $text ; close(OUT) ; system("touch --reference $file fix.tmp") ; system("chown --reference $file fix.tmp") ; system("mv fix.tmp $file") ; print "Fixed $file\n" ;