Hello, I am relatively new to Perl and have had no success in modifying
an old data extraction program to work. It is executed with the
following .bat command line code:
C:\Perl\bin\perl fbi2xls.pl *.fbi
copy /y allunits.xls c:\cavedog\totala\docs\allunits.xls
Unfortunately, while individual files may be sucessfully extracted,
wildcard "*" is not honoured. I have tried lengthy searches and several
mode to the following program (below) without sucess (I run WIN98SE).
Can someone help!
Best regards,
Daniel Paris
Fbi2xls.pl program:
#!perl -w
#
# usage: perl fbi2xls.pl *.fbi
#
# converts .fbi files into comma-delimited text for excel
@headers = ();
for $filename (@ARGV) {
print "reading $filename\n";
open(FBI,"<$filename") || die "can't open $filename: $!";
while(<FBI>) {
s/^\s+//; # remove leading whitespace
s/\s+$//; # remove trailing whitespace
s/;$//; # remove trailing semicolon
next if /^$/; # ignore blank lines
next if /^\[UNITINFO\]$/; # ignore header
next if /^\{$/; # ignore opening brace
next if /^\}$/; # ignore closing brace
($header,$value) = split(/\s*=\s*/,$_,2);
$entry{$filename}{$header} = $value;
if(!$header_exists{$header}) {
$header_exists{$header} = 1;
push @headers,$header;
}
}
close FBI;
}
# open XLS file and print header line
open (XLS,">allunits.xls") || die "can't create allunits.xls: $!";
print XLS join("\t",@headers) . "\n";
# print out unit data
for $filename (@ARGV) {
for $header (@headers) {
$value = $entry{$filename}{$header};
$value = "" unless defined($value);
print XLS "$value\t";
}
print XLS "\n";
}
close XLS;
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users