Akron | 54c5221 | 2022-03-07 18:56:21 +0100 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | |
| 5 | our @ARGV; |
| 6 | |
| 7 | my $file = $ARGV[0]; |
| 8 | |
| 9 | open(X, '<' . $file); |
| 10 | open(RAW, '>' . $file . '.raw'); |
| 11 | open(SPLIT, '>' . $file . '.split'); |
Akron | 049e526 | 2022-03-18 09:59:34 +0100 | [diff] [blame^] | 12 | open(EOS, '>' . $file . '.eos'); |
Akron | 54c5221 | 2022-03-07 18:56:21 +0100 | [diff] [blame] | 13 | |
| 14 | my $init; |
| 15 | |
| 16 | while(!eof(X)) { |
| 17 | local $_ = <X>; |
| 18 | |
| 19 | if (/^# text = (.+?)$/) { |
| 20 | if ($init) { |
| 21 | print SPLIT "\n"; |
| 22 | print RAW ' '; |
| 23 | }; |
| 24 | print RAW $1; |
Akron | 049e526 | 2022-03-18 09:59:34 +0100 | [diff] [blame^] | 25 | my $temp = $1; |
| 26 | $temp =~ s/[\s\n\t]+//g; |
| 27 | print EOS $temp, "\n"; |
Akron | 54c5221 | 2022-03-07 18:56:21 +0100 | [diff] [blame] | 28 | } |
| 29 | elsif (m/^\d+[\s\t]/) { |
| 30 | if (/^\d+[\s\t]+([^\t\s]+)[\t\s]/) { |
| 31 | print SPLIT $1,"\n"; |
| 32 | $init = 1; |
| 33 | } |
| 34 | }; |
| 35 | }; |
| 36 | |
| 37 | close(X); |
| 38 | close(RAW); |
Akron | 049e526 | 2022-03-18 09:59:34 +0100 | [diff] [blame^] | 39 | close(EOS); |
Akron | 54c5221 | 2022-03-07 18:56:21 +0100 | [diff] [blame] | 40 | close(SPLIT); |