blob: e372d6815d5d0d8828f905486f1e8f5d1467787c [file] [log] [blame]
Akron54c52212022-03-07 18:56:21 +01001#!/usr/bin/env perl
2use strict;
3use warnings;
4
5our @ARGV;
6
7my $file = $ARGV[0];
Akron93ff8692022-03-18 13:14:05 +01008my $file_name = $file;
9$file_name =~ s!^.+?/([^/]+?)$!$1!;
10
11
12my $out = $ARGV[1];
Akron54c52212022-03-07 18:56:21 +010013
14open(X, '<' . $file);
Akron93ff8692022-03-18 13:14:05 +010015unlink $file . '.raw';
16open(RAW, '>' . $out . '/' . $file_name . '.raw') or die $!;
17unlink $file . '.split';
18open(SPLIT, '>' . $out . '/' . $file_name . '.split') or die $!;
19unlink $file . '.eos';
20open(EOS, '>' . $out . '/' . $file_name . '.eos') or die $!;
Akron54c52212022-03-07 18:56:21 +010021
22my $init;
23
24while(!eof(X)) {
25 local $_ = <X>;
26
27 if (/^# text = (.+?)$/) {
28 if ($init) {
29 print SPLIT "\n";
30 print RAW ' ';
31 };
32 print RAW $1;
Akron049e5262022-03-18 09:59:34 +010033 my $temp = $1;
34 $temp =~ s/[\s\n\t]+//g;
35 print EOS $temp, "\n";
Akron54c52212022-03-07 18:56:21 +010036 }
37 elsif (m/^\d+[\s\t]/) {
38 if (/^\d+[\s\t]+([^\t\s]+)[\t\s]/) {
39 print SPLIT $1,"\n";
40 $init = 1;
41 }
42 };
43};
44
45close(X);
46close(RAW);
Akron049e5262022-03-18 09:59:34 +010047close(EOS);
Akron54c52212022-03-07 18:56:21 +010048close(SPLIT);