blob: 044edb24e2d5e1e7ab8a1f4f9bdb204afa3b9c6b (
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
|
#!/usr/bin/perl -w
use strict;
open(FH, $ARGV[0]);
open(OFH_ONE, "> ".$ARGV[1]);
open(OFH_TWO, "> ".$ARGV[2]);
my $line;
my $alt = 0;
my $header = <FH>;
printf(OFH_ONE $header);
printf(OFH_TWO $header);
while ( $line = <FH> ) {
if ( $line =~ /^-----\ Begin chunk\ -----$/ ) {
$alt = 1 - $alt;
}
if ( $alt == 0 ) {
printf(OFH_ONE $line);
} elsif ( $alt == 1 ) {
printf(OFH_TWO $line);
} else {
printf("Unhandled: '%s'\n", chomp($line));
}
}
|