/[webpac2]/trunk/bin/isi-merge.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/bin/isi-merge.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1283 - (show annotations)
Fri Sep 18 18:35:50 2009 UTC (14 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 540 byte(s)
merge isi files, with support for from-to range in filenames

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;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26