HPlogo Native Mode Spooler Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 5 Utilities

FIND

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Glossary

 » Index

Locates a specified pattern in a specified range of the current spool file.

Syntax

   > F[IND] [ @

              +

              ^ ] ["string"] [,range]

where range is

   [[recnumber[{+

                -} offset]

     * [{+

         -} offset]

     FIRST [{+

             -} offset]

     LAST  [{+

             -} offset] ] [, count

                                                                    / recnumber[{+

                                      -} offset]

                                                                    / * [{+

                                                                          -} offset]

                                                                    / FIRST [{+

                                                                              -} offset]

                                                                    / LAST [{+

                                                                             -} offset] ]

      ALL ]

Semantics

The FIND command operates only on the currently TEXTed spool file. It is an error if used when there is no current spool file.

Range expressions are limited to:

(first line number of file) <= expression <= (last line number of file).

Lines are numbered from 0 to N-1. No error is generated for exceeding these limits; SPIFF simply limits the expression. For example, FIRST-2 evaluates to FIRST.

Specifying a first position range expression that evaluates to a greater line number than that of the second position range expression is an error.

NOTE: The expression, not its components, is tested. A range of LAST/FIRST is always an error, but a range of LAST-20/FIRST+40 is valid for any file consisting of no more than 61 lines (numbered 0 to 60).

Parameters

@

By default, FIND locates only those occurrences of "string" that begin at the first character of a line. Specification of @ causes FIND to locate occurrences of "string" without regard to their position in the line.

You can use the MODE @ =... command to enable or disable the @ option. With the option enabled, it is not necessary to specify the @ as part of the FIND command; however, specifying it is not an error and has no effect on command operation.

+

By default, the FIND operation stops at the first occurrence of the pattern in the specified (or defaulted) line range. Specification of + causes FIND to locate all occurrences of the pattern in the range.

You can use the MODE + =... command to enable or disable the + option. With the option enabled, it is not necessary to specify the + as part of the FIND command; however, specifying it is not an error and has no effect on command operation.

NOTE: Do not confuse this use of + with that of the addition (positive offset) operator in a range expression.
^

By default, FIND is case sensitive. If you specify "error" as the search pattern, lines containing Error or ERROR will not be detected. Specifying ^ (caret) makes FIND case insensitive.

You can use the MODE ^ =... command to enable or disable the ^ option. With the option enabled, it is not necessary to specify the ^ as part of the FIND command; however, specifying it is not an error and has no effect on command operation.

"string"

The pattern to be located by FIND. The double quotes are required around the pattern. If you omit this parameter, FIND locates the first line in the specified or defaulted line range.

range

The subset of records of the spool file(s) to search. The default range is from the current record to the last one, that is */LAST.

Any line number specified that is outside the range of lines in the spool file will be handled as though FIRST or LAST was specified, as appropriate. If the range consists of two expressions, the first expression must evaluate to a number no larger than the second.

ALL

Specifies that all of the records in the spool file(s) should be searched. No other range element is allowed if this keyword is used.

FIRST

The first record in the spool file.

LAST

The last record in the spool file.

*

The current record in the spool file.

recnumber

An absolute record or line number of text in the spool file. Records are numbered starting with 0.

offset

A relative number of records before (-) or after (+) the specified record.

count

A numeric value, the number of lines to be searched, including the starting record.

Operation Notes

The FIND command searches a range of records in the currently TEXTed spool file for a specified pattern string, displaying the first one found. A command option allows displaying all matches found in the range.

With no options specified, the FIND command searches for and displays the first case sensitive match of the specified string if the match begins in column 1 of the record. Any of the three options broaden the searching capabilities of the command. The options may be specified singly or in any combination. Thus @+^+@++@^ and ++++ are both valid. Refer to the "Syntax" description above.

Any or all of the three options may be enabled or disabled by using the appropriate option of the MODE command. If an option is enabled using MODE, it need not be specified in the FIND command. Enabling an option already enabled by the MODE command is not an error and has no effect on command operation.

The current record pointer is left at the record following the one that matches the specified pattern, unless the + option is specified or unless no match is found in the specified range. For either of these situations, the current record pointers is left at end-of-range + 1 (or at LAST, whichever is less).

Examples

EXAMPLES OF range:

 

   */*+20 

   *-20/* 

   ALL 

   FIRST/LAST 


   */LAST 

   LAST-100/LAST

   FIRST,20 

   100/200 

   5 

EXAMPLES OF COMMANDS:

Command

Action

FIND +^@ "error", ALL''

Locates all records in the spool file containing the pattern "error", whether in upper or lower case (or a mixture thereof), anywhere in the line.

FIND ^@ "error", FIRST/100''

Restricts the search to the first occurrence of that same pattern, this time somewhere in the first 101 records.

FIND @ "error", */LAST''

Locates the first occurrence of the pattern whose case, upper or lower, exactly matches that specified, this time somewhere between the current record and the last.

Feedback to webmaster