1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#!/usr/bin/perl -w
use strict;
my $lastline = undef;
while (<>) {
my $line = $_;
if ($line =~ /textblock/) {
while (<>) {
$line = $_;
/^ }/ and last;
}
$lastline = $line;
} else {
print $lastline if defined $lastline;
if ($line =~ /y0/) {
$line = " \"y0\": 72.0,\n";
} elsif ($line =~ /"x"/) {
$line = " \"x\": -50.0,\n";
} elsif ($line =~ /"y"/) {
$line = " \"y\": 0.0\n";
} elsif ($line =~ /"scale"/) {
$line = " \"scale\": 0.33,\n";
}
$lastline = $line;
}
}
print $lastline if defined $lastline;
|