From 136e2f1ebed50a1bd6057777ca3e41d5b30e3663 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Tue, 24 Jun 2014 14:36:33 -0700 Subject: [PATCH] by default, strip leading directories in worksheet names --- txt2xls | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- 2.39.2