T - Test for pattern.

Syntax:

T/pattern/
T~/pattern/

Examples:

t/abc/
3t/^%/
4,10t~/z$/

Options:

/
It is general practice to use / as a delimiter in many commands. However, any non-alphanumeric character can also be used. The final delimiter may be omitted if O-S/ is in effect and the T command is immediately followed by a new-line.
~
If the ~ character precedes pattern, T will test for any lines that do not contain a string matching the pattern. Thus
t~/X/

sets the condition register TRUE if the current line does not contain an X, and FALSE if there is an X.

Description:

T checks one or more lines to see if they contain a string that matches pattern. If T finds a match, it sets the condition register TRUE and "." to the first line where the match occurred. If there is no match, T sets the condition register FALSE and does not change ".".

 

If you do not specify an addresses, T checks only the current line. If you specify one address, T checks that line instead. If you specify two addresses, T checks all the lines between and including those two lines. If the first address comes later in the buffer than the second address, T will begin at the first address and go backwards through the buffer in search of a match for pattern. This is the one case where you can specify a pair of addresses for a FRED command and have the first address come after the second in the buffer.

When you execute T from a buffer, no error will result if T tries to test a line that isn't there. For example,

*t/./

is the usual way to test if the current buffer is empty; it sets the condition register true or false, depending on whether the buffer is empty, but does not generate an error. This only works when you execute T from a buffer or from the hidden buffer of a G or U command. If you execute T directly from the terminal on a non-existent line, FRED issues an error.

Copyright © 1998, Thinkage Ltd.