SCO Visual Tcl Reference Guide
Chapter 2, TclX - the Extended Tcl language

File scanning commands (TCLX)

File scanning commands (TCLX)

These commands provide a facility to scan files, matching lines of the file against regular expressions and executing Tcl code on a match. With this facility you can use Tcl to do the sort of file processing that is traditionally done with awk(C). Because the Tcl language is more declarative, some of the scripts that can be difficult to write in awk are simple to code in Tcl.

File scanning in Tcl centers around the concept of a ``scan context''. A scan context contains one or more match statements, with associated regular expressions to scan for, and Tcl code to be executed when the expressions are matched.

See the manual pages for the following commands: