blob: 3edc763d0a0e2ee7b42ef0007f0cb0ec36a1341c (
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
|
# script to split file into parts of roughly 32kb
#!/bin/perl
my $file = shift;
my $target = shift;
my $count = 1;
my $len = 0;
$target=~/p(\d+).js/;
my $part = $1;
open(F,"<$file") || die ("cannot open file for reading: $!");
open(G,">$target") || die("cannot open file for writing: $!");
while (<F>)
{
if ($part==$count)
{
print G "$_";
}
$len+=length($_);
if ($len>32768)
{
$len=0;
$count++;
}
}
close(F);
close(G);
|