X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=txt2xls;h=c79fb53b2d1c2ff63594602f14c280b34ac97cbc;hb=dcce90e77c92202b5fadca48de6fd1cefc41ff79;hp=89580044f9d9670e76de4d8ffdcc60bf51abbb36;hpb=74198bfc4dfa8dee68448b6fdf35dd10d1a4721a;p=bin.git diff --git a/txt2xls b/txt2xls index 8958004..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) { @@ -147,7 +154,7 @@ for my $file (@ARGV) { $file = "STDIN"; } else { - $fh = IO::File->new($file,'r') or + open($fh,'<:encoding(utf8)',$file) or die "Unable to open $file for reading: $!"; } my $ws_name = $file;