Skip to content

Instantly share code, notes, and snippets.

@parastuffs
Created January 26, 2016 21:38
Show Gist options
  • Save parastuffs/d1e1323613327832f270 to your computer and use it in GitHub Desktop.
Save parastuffs/d1e1323613327832f270 to your computer and use it in GitHub Desktop.
Output the lines that were modified between two .ass, ignoring the time.
use strict;
use warnings;
my $filenameOrig = 'Senkou 06 OK.ass';
my $filenameMod = 'Senkou 06 OK_adpat.ass';
open my $fileOrig, $filenameOrig or die "Could not open $filenameOrig: $!";
open my $fileMod, $filenameMod or die "Could not open $filenameMod: $!";
while( my $lineMod = <$fileMod>) {
seek $fileOrig, 0, 0;
my $hit = 0;
# If it is a sub line
if ($lineMod =~ m/\d+,\d+,\d+,,(.*)/) {
my $lineModStrip = $1;
while( my $lineOrig = <$fileOrig>) {
# If it is a sub line
if ($lineOrig =~ m/\d+,\d+,\d+,,(.*)/) {
if ($lineModStrip eq $1) {
$hit = 1;
}
}
}
if ($hit == 0) {
print $lineMod;
}
}
}
close $fileOrig;
close $fileMod;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment