1 |
#!/usr/bin/perl |
2 |
|
3 |
use warnings; |
4 |
use strict; |
5 |
use autodie; |
6 |
|
7 |
my @files = @ARGV; |
8 |
@files = glob '/tmp/isi.*-*.txt' unless @files; |
9 |
|
10 |
my $path = '/tmp/isi.full.txt'; |
11 |
open(my $out_fh, '>', $path); |
12 |
print $out_fh "FN ISI Export Format\nVR 1.0\n"; |
13 |
|
14 |
foreach my $file ( sort { |
15 |
my $a_r = $1 if $a =~ m{(\d+)-\d+}; |
16 |
my $b_r = $1 if $b =~ m{(\d+)-\d+}; |
17 |
$a_r <=> $b_r; |
18 |
} @files ) { |
19 |
warn $file; |
20 |
|
21 |
open(my $fh, '<', $file); |
22 |
while(<$fh>) { |
23 |
next if m/^(FN|VR|EF)/; |
24 |
|
25 |
print $out_fh $_; |
26 |
} |
27 |
} |
28 |
|
29 |
print $out_fh "EF\n"; |
30 |
close $out_fh; |
31 |
|
32 |
warn "# $path ", -s $path; |