From c4bd09abad3e63a82ced6d9a402828ee9a00062b Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Wed, 10 May 2017 11:38:25 -0700 Subject: [PATCH] allow specifying output filename in txt2xls --- txt2xls | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/txt2xls b/txt2xls index 6ac3a94..c79fb53 100755 --- 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) { -- 2.39.2