From: Don Armstrong Date: Tue, 24 Jun 2014 21:36:33 +0000 (-0700) Subject: by default, strip leading directories in worksheet names X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=136e2f1ebed50a1bd6057777ca3e41d5b30e3663;p=bin.git by default, strip leading directories in worksheet names --- diff --git a/txt2xls b/txt2xls index ce36965..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;