SPUG: Re: Sourceforge ....

Scott Blachowicz scott at sabmail.rresearch.com
Wed Aug 16 16:15:53 CDT 2000


On Wed, Aug 16, 2000 at 01:57:21PM -0700, casey at haakenson.com wrote:
> You could get around all requests coming from your box by tweaking your
> /etc/hosts file to point images.sourceforge.net to a local IP, just have
> apache setup to VirtualHost that IP to the right DocumentRoot on your
> system to match their directory structure.  That way all requests from the
> PHP engine to images.sourceforge.net will be handled.  Not pretty, but it
> should work.

Or wave a little perl over the code...

  find . -type f \( -name '*.php' -o -name '*.htm*' \) -print |
   xargs grep -l 'images\.sourceforge\.net' |
   xargs perl -pi.bak -e 's/images\.sourceforge\.net/images.seattleperl.com/g'

which doesn't handle the case of no files matching that 'grep', but
it's enough to illustrate.  The perl "-i.bak" file will do in-place
editing of the file, leaving the original in a FILENAME.bak file.  The
"-p" option wraps the perl code in a loop that takes care of printing
each line after the content of the loop is executed.  The content of
the loop is provided by the "-e '...'" option.

Scott

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For full traffic, use spug-list for LIST ; otherwise use spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list