# Simple script to count user-agent strings in an httpd log file BEGIN { # variables are implied 0. no need to initialize them. } / serf\// { ++serf ; next } / neon\// { ++neon ; next } / SVNKit\// { ++svnkit ; next } /"SVNKit 1/ { ++svnkit ; next } / Googlebot/ { ++google ; next } / bingbot\// { ++bing ; next } /Baiduspider/ { ++baidu ; next } / AhrefsBot\// { ++ahrefs ; next } / YandexBot\// { ++yandex ; next } /"Sogou web spider\// { ++sogou ; next } /"Artifactory\// { ++artifactory ; next } /"Wget\// { ++wget ; next } / maven-artifact\// { ++maven ; next } / Commons-HttpClient\// { ++httpclient ; next } /"Nexus\// { ++nexus ; next } / Gecko\// { ++mozilla ; next } / Chrome\// { ++chrome ; next } / MSIE / { ++msie ; next } / Safari\// { ++safari ; next } /"Java\// { ++java ; next } # no matches above. retain for later review. #{ print } # or: just count them. { ++other } END { print "serf", serf print "neon", neon print "svnkit", svnkit print "google", google print "bing", bing print "baidu", baidu print "ahrefs", ahrefs print "yandex", yandex print "sogou", sogou print "artifactory", artifactory print "wget", wget print "maven", maven print "httpclient", httpclient print "nexus", nexus print "mozilla", mozilla print "chrome", chrome print "msie", msie print "safari", safari print "java", java print "other", other }