#!/bin/ksh # Count the occurances of UPS IP addresses # in visit_cnt_ups_sucks.log typeset -i ups_cnt=1016 # Does file exist? if [ -a visit_cnt_ups_sucks.log ]; then while read IP rest; do IP=${IP%.*} if [ ${IP%.*} = '153.2' ]; then let ups_cnt=$ups_cnt+1 fi done < visit_cnt_ups_sucks.log fi print 'Content-type: text/html' print '' if (( $ups_cnt == 0 )); then print 'no' else print $ups_cnt fi