The tgrep sample program is a multithreaded version of find(1) combined with grep(1). tgrep supports all but the -w (word search) options of the normal grep, and a few exclusively available options.
By default, the tgrep searches are like the following command:
find . -exec grep [ options ] pattern {} \;
For large directory hierarchies, tgrep gets results more quickly than the find command, depending on the number of processors available. On uniprocessor machines it is about twice as fast, and on four processor machines it is about four times as fast.
The -e option changes the way tgrep interprets the pattern string. Ordinarily (without the -e option) tgrep uses a literal string match. With the -e option, tgrep uses an MT-Safe public domain version of a regular expression handler. The regular expression method is slower.
The -B option tells tgrep to use the value of the environment variable called TGLIMIT
to limit the number of threads it will use during a search. This option has no affect if TGLIMIT
is not set. Because tgrep can use a lot of system resources, this is a way to run it politely on a timesharing system.