Your Ad Here

Selasa, 01 Juni 2010

Unix Tip: AWK THE STATS

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3038 - June 1, 2010

http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


AWK THE STATS


AWK script for getting statistics.

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
}

Tidak ada komentar:

Posting Komentar

Your Ad Here
Free Automatic Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink