Version 2 of Ashish patnaik

Updated 2004-10-29 20:46:29

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 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"