-
-
Save aliesbelik/2173a18734205f5886c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
print "Processing ${ARGV[0]}, filtering domain ${ARGV[1]}\n"; | |
open INPUT, ${ARGV[0]} or die $!; | |
open OUTPUT, ">${ARGV[0]}.filtered.xml" or die $!; | |
my $skip = 0; | |
while (my $line = <INPUT>) { | |
if ($line =~ /<request>/) { | |
if ($line =~ /http:\/\/(.*?)\//) { | |
if (!($1 eq ${ARGV[1]})) { | |
print "Skipping $1\n"; | |
$skip = 1; | |
} else { | |
print OUTPUT $line; | |
$skip = 0; | |
} | |
} else { | |
if ($skip == 0) { | |
print OUTPUT $line; | |
} else { | |
# print "Skipping...\n" | |
} | |
} | |
} else { | |
print OUTPUT $line; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment