summaryrefslogtreecommitdiff
path: root/Tools/schnitt/cut.pl
blob: e055076922696fb44a8d34e90a5cbeb033c0fb84 (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
31
32
33
34
35
#!/usr/bin/perl

chdir ($ARGV[0]) if ($ARGV[0]);

$read = $size = 1024*1024;

$filenum = "1";
$count = 0;

$fi = sprintf ("part%d",$filenum);
open (FI,">$fi");

while ($read == $size)
  {
    if ($count < 660*1024*1024)
      {
	$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;