From 02f4425ceadec0c10c1e9903286c1121a9313357 Mon Sep 17 00:00:00 2001 From: Vasil Zlatanov Date: Mon, 24 Jun 2019 21:31:41 +0100 Subject: Public FYP Release --- util/splitter | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 util/splitter (limited to 'util/splitter') diff --git a/util/splitter b/util/splitter new file mode 100755 index 0000000..0373669 --- /dev/null +++ b/util/splitter @@ -0,0 +1,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"); -- cgit v1.2.3-70-g09d2