]> git.donarmstrong.com Git - bin.git/blobdiff - txt2xls
by default, strip leading directories in worksheet names
[bin.git] / txt2xls
diff --git a/txt2xls b/txt2xls
index ce3696590a687ba5543eb7d471c3eda3bbe3745a..89580044f9d9670e76de4d8ffdcc60bf51abbb36 100755 (executable)
--- 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;