#!/bin/csh -f # # The getafs will use Notre Dame Ph server to find out the # afs_id listed in that server, if nd.edu e-mail address is given. # # Usage: getafs input_file # The input file must be of the form from classlist-Email. # The output will be written on input_file.afs in a format # afs_id appears in the first column # File input_file.grd and input_file.hws will also be creadte # with only the first column containing afs id # if ("$*" == '') then echo " The getafs will use Notre Dame Ph server to find out the" echo " afs_id listed in that server, if nd.edu e-mail address is given" echo " " echo " Usage: getafs input_file" echo " The input_file must be of the form from classlist-Email." echo " The output will be written on input_file.afs in a format" echo " afs_id appears in the first column " echo " File input_file.grd and input_file.hws will also be creadte" echo " with only the first column containing afs id" echo " " exit(-1) endif if ( -f "$*.grd" || -f "$*.hws" ) then echo "$*.grd and/or $*.hws exists, exit" exit(-1) endif if -f "$*.afs" then echo -n "overwrite $*.afs (y/n)? " set YES = "$<" if ("$YES" != 'y') then echo "--->$*.afs NOT updated. Exit" exit(-1) else \rm -f "$*.afs" endif endif if !( -f $*.new ) clean $* /bin/rm -f list-tmp /bin/awk -F\t '{ OFS = "\t"; print $1, $2, $3, $12 }' $*.new > list-tmp echo "--->It will take a while to ph all names in your list, if your list" echo "is long. Please be patient" set EMAIL = `/bin/awk -F\t '/^[0-9][0-9][0-9]/ {print $4}' list-tmp` echo "AFS_LOGIN_ID ID_Number Last_Name First_Name Email_Address" > $*.afs @ i=0 set PH = /usr/local/bin/ph while ("$i" < "$#EMAIL") @ i+=1 set FN = `$PH unique="$EMAIL[$i]" return afs_id | sed -n -e '/afs_id/s/ \{1,20\}afs_id://p'` ( echo -n "$FN"" "" "; grep "$EMAIL[$i]" list-tmp ) >> "$*.afs" end /bin/rm -f list-tmp /bin/awk -F\t '{ OFS = "\t"; print $1}' $*.afs > "$*.grd" /bin/cp "$*.grd" "$*.hws"