#!/bin/sh

# created 20040629 
# removes nonexistent users from genericstable
# then does a sort unique to remove dupes

>newgen
while read line
do
 name=`echo $line | awk '{ print $1 }'` 
 grep ^$name /etc/passwd >/dev/null
 if [ "$?" = "0" ]
 then
   echo add $line to new genericstable
   lastpart=`echo $line | awk '{ print $2 }'`
   printf "%-10s $lastpart\n" "$name" >>newgen
 else
   echo remove $name from genericstable
 fi
   
done <genericstable

cat newgen | sort | uniq >newgen2
mv newgen2 newgen

echo
echo "---> verify newgen and cat > into genericstable if good"