Skip to content

Instantly share code, notes, and snippets.

@c9s
Created April 8, 2009 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c9s/91853 to your computer and use it in GitHub Desktop.
Save c9s/91853 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use warnings;
use utf8;
local $|=1;
my @files = @ARGV;
for my $file ( @files ) {
my $out = $file . ".out";
print "Processing $file";
open FH,"<", $file;
open OUT,">", $out;
my ($line,$reserved,$stripped) = (0,0,0);
while( <FH> ) {
print "\r" . $line++ . " " x 20 ;
unless( m#\d{2}:\d{2}\s-\!-\s# ) {
print OUT $_;
$reserved++;
}
else {
$stripped++;
}
}
print "\n";
close FH;
close OUT;
rename $out ,$file;
print "Stripped: " . "-" x $stripped/10 . "\n";
print "Reserved: " . "+" x $reserved/10 . "\n";
print "Moving $out to $file\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment