From: Dobrica Pavlinusic Date: Thu, 9 Apr 2015 15:39:17 +0000 (+0200) Subject: convert file from command-line argument X-Git-Url: http://git.rot13.org/?p=webpac2;a=commitdiff_plain;h=1d3a5acce3d324fe23879099b79906d2671c6b56 convert file from command-line argument --- diff --git a/scripts/mab2marc.pl b/scripts/mab2marc.pl index cf94618..9dd4b68 100755 --- a/scripts/mab2marc.pl +++ b/scripts/mab2marc.pl @@ -6,8 +6,14 @@ use MARC::Record; use Encode; use Data::Dump qw(dump); -open(my $m21, '<', 'agram-3.m21'); -open(my $out, '>:encoding(utf-8)', 'agram-3.marc'); +my $source = shift @ARGV || die "usage: $0 file.m21\n"; +my $dest = $source; +$dest =~ s/\..+/.marc/; + +open(my $m21, '<', $source); +open(my $out, '>:encoding(utf-8)', $dest); + +warn "# convert $source => $dest\n"; my $last_id; my @fields;