#!/usr/bin/perl
open(LIST,">list.html");
print LIST "
";
$dir=opendir(DIR,"files");
print "open=$dir\n";
while($file=readdir(DIR) )
{$prod="";
#print "File=$file \n";
if($file =~ /^ms\d\d\d\d/)
{
print "$file \n";
open(MSDS,"files/$file");
while()
{
chop;
s/\t//g;
s/\r//g;
if(/Product Name:/){
print;
s/Product Name//;
s/^ *\: *//;
$name=$_;}
if(/Product Number\:/)
{s/Product Number *\: *//;
$num=$_;
$num =~ s/^ *//;
last;}
}
$file =~ s/l$//;
$prod = "
Techspray--$name $num\n";
close(MSDS);
push @list, "$name/#$prod";
}
}
@new= sort @list;
foreach(@new){s/^.*\#//;}
print LIST @new;
close(LIST);
exit;
system "grep \"Product Name\" ms0* > names";
open(IN,"names");
while()
{
chop;chop;
print;
/(ms\d\d\d\d.html)\:\s*Product Name\:\s*(.*)/;
$file=$1;$name=$2;
$prod=" Noprod ";
print "\nopening file=$file\n";
open(MSDS,"$file");
while(){if(/Product Number/)
{print"\nfound prodnum";chop;$prod=$_;last;}}
close(MSDS);
print $prod;
$prod =~ s/Product Number://;
#print "file=$file Name=$name Prod=$prod\n";
$line = " $name $prod $file\n";
push @name, $line ;
}
#print "HERE IS THE NAME ARRAY";
#print @name;
#print "======\n=====\n";
@new = sort @name;
#foreach(@new){print "$_";}
foreach(@new)
{
s/(ms\d\d\d\d.html)//;$url=$1;
chomp;
#print "newline=$_ URL=$url\n";
$_="
Techspray--$_\n";
}
#Techspray -- $1<\/a>
/;}
#s/(.*)(ms00\d\d.html)/Techspray -- $1<\/a>
/;}
open OUT , ">index.html"; print OUT @new;
system "cp index.html list.html";