[Richard Suchenwirth] 2002-07-21 - I needed such a little tool at work, and thought that other Tclers might use it too. Basically it is a small UI wrapper for searching a text file. Specify your search term in the [entry] above, hit , and see in the [text] which lines from the file given at startup matched. For convenience, case is ignored (one might make this switchable); the entry is cleared on cursor ; and the number of matching lines is displayed in the end. ---- proc ui {} { entry .e -bg white -textvar search bind .e {search $search .t} bind .e {set search ""} text .t -yscrollcommand ".y set" -bg white -wrap word scrollbar .y -command ".t yview" grid .e - -sticky ew grid .t .y -sticky news grid columnconfig . 0 -weight 1 grid rowconfig . 1 -weight 1 } proc readfile {file varName} { upvar \#0 $varName data set fp [open $file] set data [split [read $fp] \n] close $fp } proc search {re w} { global data $w delete 1.0 end set n 0 foreach line $data { if {[regexp -nocase $re $line]} { $w insert end $line\n incr n } } $w insert end "Found $n lines" $w see end } readfile [lindex $argv 0] data ui ----