Hi ai am ashish patnaik .. a newbie to TCL .. you might be seeing a lot of questions from me than answers :-)
#!/usr/bin/tcl # Count accesses from a series of computers to a serverset fhandle [open seal_log r] # CL observes that the next line likely does NOT evaluate as # intended. Consider what happens if the only content is the # single digit "0". while {[set line [gets $fhandle]] >0} { set hitlist [split $line] set hostname [lindex $hitlist 0] if {[info exists counter($hostname)]} { incr counter($hostname) } else { set counter($hostname) 1 } } foreach host [lsort [array names counter]] { puts "$host accessed us $counter($host) times" }