Next: prune procedure, Previous: which procedure, Up: Utility Procedures [Contents][Index]
Search a named file for lines that contain a match for a regular expression. The result is a list of all the lines that match. If no lines match, the result is an empty string. All of the Tcl regular expression syntax is supported.
grep -n filename regexp line
-n
The -n
option prefixes matched lines in the result with the
line number, just like GNU grep
does. This option should be
used in preference to the line
keyword documented below.
filename
The file to search.
regexp
The Unix style regular expression (as used by the grep
UNIX
utility) to search for.
line
Use the optional keyword line
to prefix matched lines in the
result with the line number. This usage is deprecated.