|
楼主 |
发表于 2004-8-11 20:24:15
|
显示全部楼层
我自己写了个程序。可是不能完成这样的功能。
#!/usr/local/bin/perl
if(@ARGV!=2)
{
print "Usage : <sheet file> <out sheet file> \n";
exit(0);
}
($iSheet,$oSheet)=@ARGV;
open(INSHEET,$iSheet) || die "Cannot open >$iSheet< for reading\n";
open(OUTSHEET,">$oSheet") || die "Cannot open >$oSheet< for writing\n";
$Ln=0;
while($l=<INSHEET>) # Start of input report reading
{
chop($l);
$line[$Ln]=$l;
$Ln=$Ln+1;
}
@mode=split(/\s+/,$line[0]);
$row_nu=@line;
$mode_nu=@{mode};
$mode_nu=$mode_nu - 2;
print "mode_number= ${mode_nu} \n";
print "row_number= ${row_nu} \n";
for($j=1;$j< ${row_nu};$j++) {
@row_split=split(/\s+/,${line}[$j]);
#print @row_split;
#print "\n";
for($i=0;$i<$mode_nu;$i++) {
${${mode_list}[${i}]}{"${row_split}[0]"} = join(" ",${row_split}[4*${i}+1],${row_split}[4*${i}+2],${row_split}[4*${i}+3],${row_split}[4*${i}+4]);
#print ${${mode_list}[${i}]}{"${row_split}[0]"};
#print "\n";
}
}
print @{${mode_list}[0]};
for($j=0;$j<$mode_nu;$j++) {
print OUTSHEET ${mode}[1+$j];
print OUTSHEET "\n";
print OUTSHEET "setup_slack setup_nu hold_slack hold_nu \n";
for($i=1;$i<$row_nu;$i++) {
@row_split=split(/\s+/,${line}[${i}]);
#print ${row_split}[0];
#print "\n";
print OUTSHEET ${row_split}[0]."\t";
print OUTSHEET ${${mode_list}[${j}]}{"${row_split}[0]"};
print OUTSHEET "\n";
}
}
close(INSHEET);
close(OUTSHEET); |
|