summaryrefslogtreecommitdiff
path: root/util/splitter-man
blob: fbdef179a6fbb102a5b1bc97bb058cd5f6e85f60 (plain)
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
29
30
#!/usr/bin/perl
my $target;
my $md5_hash;
my $png;
my $count = 0;


while (<>){
  if (/(.*),,,vas,,,(.*),,,vas,,,(.*)/) {
    if($target){
      mkdir "images/$target" unless -d "images/$target";
      open(my $fh, '>', "images/$target/$target-$md5_hash.png") or die "could not write";
      print $fh $png;
      close $fh;
    } 
    $count++;
    $target = $1;
    $md5_hash = $2;
    $png = $3."\n";
  } else {
    $png.=$_;
  }
}

mkdir "images/$target" unless -d "images/$target";
open(my $fh, '>', "images/$target/$target-$md5_hash.png") or die;
print $fh $png;
close $fh;

print($count, " images written\n");