Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Simple first pass at it: using qr//:

    #!/home/hoffie/bin/perl
    @sunIPs=("192\\.9\\.","192\\.18\\.","192\\.29\\.");
    @f ileext=("\\.gif","\\.jpg","\\.css","\\.GIF","\\.JPG","\\.CSS");
    $filename="$ARG V[0]";
    open(IN,$filename) || die "cannot open $ARGV[0] for reading: $!";
    open(OUT,">$filename.out") || die "cannot open $filename.out for writing: $!";

    # compile once
    $fileext = join '|', @fileext;
    $fileext = qr/(?:$fileext) HTTP/;
    $sunIPs = join '|', @sunIPs;
    $sunIPs = qr/^(?:$sunIPs)/;

    LINE: while(<IN>) {
         next LINE if /$filext/;
         next LINE if /$sunIPs/;
         print OUT;
    }

    This remains untested, but I'd bet that's faster!