]> git.rmz.io Git - dotfiles.git/blobdiff - bin/fix_numbering/fixVoyager
cleaning up bin
[dotfiles.git] / bin / fix_numbering / fixVoyager
diff --git a/bin/fix_numbering/fixVoyager b/bin/fix_numbering/fixVoyager
new file mode 100755 (executable)
index 0000000..e9deb8d
--- /dev/null
@@ -0,0 +1,22 @@
+#! /usr/bin/perl
+
+###################################################################
+# This script fixes the series numbering for season 2 of Monty    #
+# Python's Flying Circus                                          #
+###################################################################
+
+use warnings;
+use strict;
+
+while (<*>) {
+       my $old_file = $_;
+       /(\d{2})/;
+       my $n = scalar $1;
+       $n += 1; 
+       $n = length($n) == 1 ? "0$n" : $n;
+       s/(\d)x\d{2}/$1x$n/;
+       
+       
+       print "$old_file -> $_\n";
+       rename($old_file,$_);
+}