X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=txt2xls;h=89580044f9d9670e76de4d8ffdcc60bf51abbb36;hb=032c1b5328dac3b7dd3e9c6736aa5676806f2f31;hp=ea2c87bd7dfe4ca08ddc8a3b2c4b9b587d2b9d3a;hpb=74a52a1a4bb4de4d1e70e388771ba9eaad1b543b;p=bin.git diff --git a/txt2xls b/txt2xls index ea2c87b..8958004 100755 --- a/txt2xls +++ b/txt2xls @@ -132,6 +132,11 @@ elsif ($options{ssv}) { $sep_char = ' '; } +if (not @{$options{remove_name}}) { + $options{remove_name} = ['.+\/', + ]; +} + my %wb_formats = (); my $csv = Text::CSV->new({sep_char=>$sep_char}); my $wb = Spreadsheet::WriteExcel->new(\*STDOUT); @@ -147,7 +152,7 @@ for my $file (@ARGV) { } my $ws_name = $file; foreach my $remove (@{$options{remove_name}}) { - $ws_name =~ s{\Q$remove\E}{}g; + $ws_name =~ s{$remove}{}g; } $ws_name =~ s{\.[^\.]+$}{}g; $ws_name =~ s/_+/ /g; @@ -187,7 +192,7 @@ for my $file (@ARGV) { my $t_ws_name = $ws_name; my $maxlen = 31-length('.'.$overflow); $t_ws_name =~ s{^(.{0,$maxlen}).*$}{$1}; - $ws = $wb->add_worksheet($ws_name.'.'.$overflow); + $ws = $wb->add_worksheet($t_ws_name.'.'.$overflow); $overflow++; $row=1; output_row(\@header_row,$row,$ws,$wb,\%wb_formats,\%options);