• Aucun résultat trouvé

FIND Command

Dans le document Reference Manual (Page 128-131)

The FIND command searches a file (by default, the work file) for appearances of specified target text. The line numbers of lines containing the target text are displayed at the user's terminal with an asterisk (*) denoting line numbers where the target text appears more than once. The output option TEXT displays the lines of text in addition to the line numbers. The FILE output option directs the lines of text to a new file instead of the terminal.

The < text> construct specifies the target text and must be bounded by two matching delimiters, < dlm>. In a single FIND command, one or more target texts can be the subject of the search. The text can contain any characters, except the < dlm> character, and cannot be null.

If a hexadecimal escape character is set through the CANDE command ESCAPE, then the target text can contain hexadecimal values delimited by the defined hexadecimal escape character. However, the target delimiter ( < dIm» cannot be the same as the hexadecimal escape character. For more information about the hexadecimal escape character, refer to the ESCAPE command earlier in this section.

The value of < count> must be an integer. The < count> construct limits the search . to the first < count> occurrences of the target. All occurrences after that number are

8600 1500-010

FIND Command (cont.)

ignored. If more than one target text is specified, < count> applies only to its associated text.

When the OCCURRENCE option is used in conjunction with < count> , the FIND command locates and displays the nth occurrence of the target specified by the count.

An integer value must be specified for the count whenever OCCURRENCE is used. If the target occurs more than once on a particular line, each occurrence on that line is counted. The integer value for the count cannot exceed 255.

The LITERAL option specifies that the mode of the search for the associated text is literal mode. The default, when LITERAL is not specified, is token mode. (A description of these search modes appears later in this explanation.)

The < file title> specifies the file to be searched and can be any file the user is allowed to access. When a file title is not specified, the work file is searched.

. The < sequence range list> restricts the lines to be searched to one or more sequence ranges.

The at sign (@) option restricts the search to a column range on each line. The < start column> specifies the column number where the search is to begin. The < end column> specifies the column number where the search is to end. The column range can specify any part of the usable line except the sequence number field (for example,

@81-90 is valid for type ALGOL files). The entire text field of the line is searched if no columns are specified. If only a start column is specified, the default end column is the last column of the text field. Thus, to search only column 1 of each line, the specification would be @1-1.

The TEXT option displays the entire line containing the target text, including the sequence number. When the TEXT option is used, all lines that have been marked with a current MARKID will have an asterisk between the sequence number and the contents of the line.

When the PAGEFORMAT option is specified, the output appears in a format similar to the page mode output. That is, the full length of the sequence number field is displayed, immediately followed by the contents of the text field (the blank or asterisk flag character is omitted).

For more information on the MARKID, refer to the GET command, the MAKE command, and the MARKID command.

The SQUASHED option causes a sequence of blanks to be printed as a single blank.

The TRUNCATED option causes the output line to be truncated to the character width of the terminal if necessary. By default, lines that exceed the terminal width are split across two or more lines.

The FILE option writes the entire line containing the target text to a new file in the user's library. The < dest file name> construct specifies the name of that new file.

The new file is the same type as the work file or file title. Files created by the FIND command are crunched by default. If a crunched file is not desired, the output option

FIND Command (cont.)

3-68

NOCRUNCH can be specified. If a file entitled < dest file name> already exists in the user's library, an error message is displayed.

The < dIm> character can be any special character except semicolon (;), comma (,), at sign (@), or colon (:). '

CANDE uses two text searching modes. Both the FIND and the REPLACE commands use these searching modes. A token mode search is performed by default, and the literal mode search can be invoked by using the LITERAL option.

In literal mode, each line of the file is considered an arbitrary string of characters, including blanks. The search is successful whenever the sequence of characters in the target text exactly matches a sequence of characters in a line of the file. For example, if the target is lit.a -b. (periods are used as < dlm> characters), the following lines contain examples of matching target text:

x

=

a - b

x

= aa - b x

=

a - bb

However, the target lit .a-b. (periods are used as < dIm> characters) is not found in those lines.

In token mode, each line is considered a sequence of tokens. The type of file on which the FIND is being pe~formed is recognized and tokens are then determined based on that file type. A token is defined as follows:

• For ALGOL, DCALGOL, DMALGOL, NDLII, NEwp, and Pascal files, one of the following:

Any group of adjacent alphanumeric characters (uppercase and lowercase letters, digits 0 through 9) and underscores ( _ )

A single nonalphanumeric graphic character that is not an underscore or a blank

• For COBOL, COBOL74, and DASDL files, one of the following:

Any group of adjacent alphanumeric characters (uppercase and lowercase letters, digits 0 through 9) and hyphens (-)

A single nonalphanumeric graphic character that is not a hyphen or a blank

• For all other file types, one of the following:

Any group of adjacent alphanumeric characters (uppercase and lowercase letters, digits 0 through 9)

A single nonalphanumeric graphic character that is not a blank

Any number of blanks can separate tokens; at least one blaDk must separate adjacent alphanumeric tokens. For example, the following line illustrates the use of tokens:

100 abc, def5-3xyz i j k& *+@ end_token The preceding line contains the following tokens:

8600 1500-010

ALGOL, DCALGOL,

The search is successful whenever the same sequence of tokens in the target text is found in a line of the file. More than one token may be included in one < text>

construct. As examples, depending on the file type, the following targets might or might not be found in line number 100 in the previous example (periods are used as < dlm>

characters) :

The following targets would not be found in line number 100 in any file type:

.a •

• 5 •

• k&.

Dans le document Reference Manual (Page 128-131)