Do not know if there is a better way, but this script was created to help detect unused tokens in source: ====== lassign $argv head while { [gets stdin line] >= 0 } { lappend fileLines $line foreach word [regexp -all -inline {[A-Za-z0-9]+} $line] { dict incr wordcount [string tolower $word] } } set fp [open "freq1.html" w] puts $fp "" puts $fp "onlies" puts $fp "" foreach line $fileLines { set text "
"
        set strLength [string length $line]
        for {set i 0} {$i < $strLength} {} {
            if {![string is alnum [string index $line $i]]} {
                append text [string index $line $i]
                incr i
            } else {
                set word [regexp -inline {[A-Za-z0-9]+} [string range $line $i end]]
                if {[dict exists $wordcount $word] && [dict get $wordcount $word] == 1} {
                    append text "" $word ""
                } else {
                    append text $word
                }
                incr i [string length $word]
            }
        }
        append text "
" puts $fp $text } puts $fp "" puts $fp "" close $fp ====== execute with "tclsh freq1.tcl < draftCode.tcl" and all singleton tokens will appear highlighted in context.