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-man/$target" unless -d "images-man/$target";
open(my $fh, '>', "images-man/$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-man/$target" unless -d "images-man/$target";
open(my $fh, '>', "images-man/$target/$target-$md5_hash.png") or die;
print $fh $png;
close $fh;
print($count, " images written\n");
|