#
# missos.awk, 25 Jan 13

BEGIN {
	OS_str="windows,win3,winnt,nt 5,nt 6,win16,win32,win95,win98,win20,winme,winxp,win xp,maci,macos,os x,osx 2,osx 6,os=mac,iphone,darwin,linux,unix,bsd,sunos,solaris,power,aix,hp-ux,openvms,osf1,irix,os/2,playstation,wii,amiga,risc os,symbian,beos,openw,red hat,suse,debian,ubuntu,sco 5,sco_,mobilephone,palmos,x-box,dragonfly,cygwin,blackberry"
	split(OS_str, OS, ",")
	suspectos=0
	}

	{
	if (NF < 3)
	   next

	total_rec+=$1
	line=tolower($0)
	for (i in OS)
	   if (index(line, OS[i]) != 0)
	      next
	total_m_os+=$1

	if (index(line, "http") != 0)
	   next
	if (index(line, "crawl") != 0)
	   next
	if (index(line, "robot") != 0)
	   next
	if (index(line, "spider") != 0)
	   next
	if (index($0, "Whois") != 0)
	   next
	if (index($0, "Ask J") != 0)
	   next
	if (index($0, "Google D") != 0)
	   next
	if (index($0, "Netcraft") != 0)
	   next
	if (index($0, "MS Fro") != 0)
	   next

	if (NF == 3)
	   {
	   if ((length($3) < 5) || ($3 ~ /[0-9.]+/))
	      next
	   }
	total_m_others+=$1

	# "ws nt" to catch missspelling of windows NT
	if ((index(line, "ws nt") != 0) ||
	    (index(line, "cp/m") != 0) ||
	    (index(line, "ZX Spectrum") != 0) ||
	    (index(line, "commodore 64") != 0))
	   {
	   suspectos++
	   next
	   }

	print $0
	next
	}

END {
	print total_rec "  " total_m_os "  " total_m_others "  " suspectos
	}

