awk的一个实例

BEGIN{
	FS=" ";
	RS="\n";
	OFS"\t";
	ORS="\n";
}
{
	if($7~/ad\/st.jsp/){
		#key=$7
		key=substr($7,match($7,"at=")+3,match($7,"&")-match($7,"at=")-3);
		if(length(key)<10){
			cl[key]++
			#if(key~/zad92420/){
			#	cl[$1]++;
			#}
		}else{
			err[key]++
		}
	}else{
		err[$0]++;
	}
}
END{
	for(key in cl){
		count+=cl[key];
		print key,cl[key];
	}
	print count;i
	for(e in err){
		print "error data:", e,err[key];
	}
}

你可能感兴趣的:(jsp)