aboutsummaryrefslogtreecommitdiff
path: root/scripts/stream-split
blob: 739b341b505decb6eba27ccba7120ee7bc193583 (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_IND, "> ".$ARGV[1]);
open(OFH_PEAKS, "> ".$ARGV[2]);

my $line;
my $mode = 0;

while ( $line = <FH> ) {

	if ( $line =~ /^Reflections\ from\ indexing/ ) {
		$mode = 1;
	}

	if ( $line =~ /^Peaks\ from\ peak\ search/ ) {
		$mode = 2;
	}

	if ( $mode == 1 ) {
		printf(OFH_IND $line);
	} elsif ( $mode == 2 ) {
		printf(OFH_PEAKS $line);
	} else {
		printf($line);
	}

}