From: Ben Ostrowsky Date: Sun, 19 Sep 2010 01:11:42 +0000 (+0000) Subject: Better output-file renaming X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=43ebb132c5d77c04962449529251715e39dc1760 Better output-file renaming --- diff --git a/xls2tab b/xls2tab index 8ddc19f..3b8dbcd 100755 --- a/xls2tab +++ b/xls2tab @@ -11,6 +11,7 @@ use warnings; use Spreadsheet::ParseExcel::Simple; use File::Spec; +use Data::Dumper; for (@ARGV) { for (glob $_) { @@ -33,7 +34,8 @@ sub dump_books { next unless $sheet[$_]->has_data(); my $sfn = $file; $sfn =~ s?\.xls$??i; - $sfn.= ((@sheet > 1) ? sprintf(".%02i",$_) : "").'.tab'; + $sfn .= '_' . $sheet[$_]->sheet->get_name() . '.tsv'; + $sfn =~ s/ /_/g; open TAB, '>', $sfn or do { warn "Unable to write to $sfn"; next;