#! /usr/local/bin/perl
open(old2f, "phone-list.txt");
open(new2f,">phone-list.dat");

flock(old2f,2);
flock(new2f,2);
$num = 0;
while ($line = <old2f>) {
    chop($line);
    if ($line =~ /#/) {next;}
    if ($line =~ /^\s*(.+, \w+)\s+(\w+)\s+(\S+)\s+(\S+)\s*$/) {
       $name = $1; 
       $uid = $2; $passwd=$uid; $phone = $3; $office = $4;
       $url = "http://www.npac.syr.edu/users/$uid/homepage/index.html";
       print new2f "$uid,\"$passwd\",\"$uid\@npac.syr.edu\",\"$name\",\"$phone\",\"$office\",\"$url\"\n";
    }
}
exit;
