The script gives the
statistics of the default
shell set for the users.
i.e. Number of users using
csh,ksh or sh
$cat stat_demo.awk
#start here
BEGIN{
FS=":"
#seperator is set to :
}
{
#$7, is 7 field in passwd file
stat_array[$7]=stat_array[$7]+1;
}
END{
print "Login-Shell Count" ;
for (i in stat_array) print i, stat_array[i]
#Displays statistics
}
#end here
To use this , Just say
awk -f stat_demo.awk /etc/passwd
or
cat /etc/passwd | awk stat_demo.awk
This tip generously supported by: dkotian1@rediffmail.com NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted
by various unix admins around the globe. UGU suggest you read and
test each tip in a non-volitile environment before placing into
production.