# Request a file name. Assume success. set fileName [tk_getOpenFile] set if [open $fileName r] set data [read $if] close $if for {set i 0} {$i < 24} {incr i} { lappend countList 0 } set usedPIDs {} foreach line [split $data \n] { lassign $line mon day time sys cmd lassign [split $time :] hr min sec if {[lsearch $cmd ssh*] == 0} { lassign [split $cmd \[] name pid if {[lsearch $usedPIDs $pid] < 0} { lappend usedPIDs $pid scan $hr %d hr set count [lindex $countList $hr] incr count lset countList $hr $count } } } puts $countList for {set i 0} {$i < 24} {incr i} { set count [lindex $countList $i] label .l_$i -text $i label .lcount_$i -text $count -anchor w # set str {} # for {set j 0} {$j < [expr log($count)]} {incr j} { # append str . # } # label .lhist_$i -text $str -bg black label .lhist_$i -bg black -width [expr $count/20] grid .l_$i .lcount_$i .lhist_$i -sticky w }