summaryrefslogtreecommitdiff
path: root/Tools/schnitt/cut.pl
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/schnitt/cut.pl')
-rwxr-xr-xTools/schnitt/cut.pl40
1 files changed, 40 insertions, 0 deletions
diff --git a/Tools/schnitt/cut.pl b/Tools/schnitt/cut.pl
new file mode 100755
index 0000000..dd62c18
--- /dev/null
+++ b/Tools/schnitt/cut.pl
@@ -0,0 +1,40 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+my $maxsize = 660 * 1024 * 1024;
+
+my $read = 1024*1024;
+my $size = 1024*1024;
+
+my $filenum = "1";
+my $count = 0;
+
+my ($fi,$data);
+
+$fi = sprintf ("part%d",$filenum);
+open (FI,">$fi");
+
+while ($read == $size)
+ {
+ if ($count < $maxsize)
+ {
+ $read = read (STDIN,$data,$size);
+ print FI $data;
+ $count += $size;
+ $a = $count /1024/1024;
+ if ($a % 10 == 0) {
+ print STDERR "File: $filenum Size: ${a}MB\n";
+ }
+ }
+ else
+ {
+ close (FI);
+ $filenum++;
+ $fi = sprintf ("part%d",$filenum);
+ open (FI,">$fi");
+ $count = 0;
+ }
+ }
+
+close FI;