]> git.donarmstrong.com Git - bin.git/commitdiff
allow specifying output filename in txt2xls
authorDon Armstrong <don@donarmstrong.com>
Wed, 10 May 2017 18:38:25 +0000 (11:38 -0700)
committerDon Armstrong <don@donarmstrong.com>
Wed, 10 May 2017 18:38:25 +0000 (11:38 -0700)
txt2xls

diff --git a/txt2xls b/txt2xls
index 6ac3a94e3b1978476f706dfd31d0add84d76ec39..c79fb53b2d1c2ff63594602f14c280b34ac97cbc 100755 (executable)
--- a/txt2xls
+++ b/txt2xls
@@ -101,7 +101,8 @@ GetOptions(\%options,
            'sci_format|sci-format=s',
            'max_digits|max-digits=i',
           'rmode|r-mode|r!',
-          'remove_name|remove-name=s@',
+           'remove_name|remove-name=s@',
+           'output|output_file|output-file=s',
           'debug|d+','help|h|?','man|m');
 
 pod2usage() if $options{help};
@@ -139,7 +140,13 @@ if (not @{$options{remove_name}}) {
 
 my %wb_formats = ();
 my $csv = Text::CSV->new({sep_char=>$sep_char});
-my $wb = Spreadsheet::WriteExcel->new(\*STDOUT);
+my $wb;
+if (defined $options{output}) {
+    $wb =  Spreadsheet::WriteExcel->new($options{output});
+} else {
+    $wb = Spreadsheet::WriteExcel->new(\*STDOUT);
+}
+
 for my $file (@ARGV) {
     my $fh;
     if (not defined $file) {