aboutsummaryrefslogtreecommitdiff
path: root/scripts/alternate-stream
blob: 1ac2fd3ad4647029d9ba46bfea5e65d4fd1948bd (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
#!/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;

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));
	}

}