HP 3000 Manuals

Search Functions [ HP Browse/XL User's Guide ] MPE/iX 5.0 Documentation


HP Browse/XL User's Guide

Search Functions 

You can use HP Browse to search for patterns of text in the files you are
browsing.

HP Browse assigns character keys for three of the five functions in the
Search keyset.  That is, you can issue a single character keystroke
command as well as use the function keys to search files in HP Browse.
These Search functions are given in Table 3-3.

          Table 3-3.  Search Functions 

--------------------------------------------------------------------------------------------------
|                       |                   |                                |                   |
|     Function Key      |   Assigned Key    |    Description of Function     |  Accepts Count?   |
|                       |      Command      |                                |                   |
|                       |                   |                                |                   |
--------------------------------------------------------------------------------------------------
|                       |                   |                                |                   |
| Search Backward       |         \         | Search backward for a          |       Yes.        |
|                       |                   | specified search pattern.      |                   |
|                       |                   |                                |                   |
--------------------------------------------------------------------------------------------------
|                       |                   |                                |                   |
| Search Forward        |         /         | Search forward for a specified |       Yes.        |
|                       |                   | search pattern.                |                   |
|                       |                   |                                |                   |
--------------------------------------------------------------------------------------------------
|                       |                   |                                |                   |
| Define Search         |         f         | Specifies a search pattern.    |        No.        |
|                       |                   |                                |                   |
--------------------------------------------------------------------------------------------------

Search Backward 

After you have defined a search pattern, press either the  Search 
Backward function key or the \ character to find the occurrence of the
pattern just previous to the postion of the cursor.  If the search
pattern is found, HP Browse moves the cursor to this previous occurrence.
If a count is specified, HP Browse will look for the countth occurrence
of the pattern before the cursor.

Search Forward 

The Search Forward function, like the Search Backward function, can be
used only after you have defined a search pattern.  When you press either
the  Search Forward function key or the / character, HP Browse looks for
the next occurrence of the search pattern and moves the cursor to this
position if the pattern is found.  If a count is specified, HP Browse
will look for the countth occurrence of the pattern after the cursor.

Define Search Pattern 

Use the Define Search Pattern function to specify a pattern for HP Browse
to search.  HP Browse allows you to specify wildcard characters,
beginning line, end line, and character classes within your search
pattern.  When you press either the  Define Search function key or the f
character, the most recent search pattern is displayed in parentheses,
allowing you to verify the current search pattern or enter a new search
pattern before you actually search your file.  However, HP Browse will
display only the first 60 characters of your previous search pattern.

Special Pattern-Matching Characters.  HP Browse has a pattern-matching
facility that enables you to use wildcard and other special characters in
order to conduct more sophisticated pattern searches of your files.  You
can use any of the pattern-matching characters of HP Browse when you
specify a pattern with the Define Search Pattern function.  To signify to
HP Browse that you want to use these special matching characters, set the
Use Pattern-Matching Chars to "Yes".  If it is set to "No", HP Browse
will treat these characters literally.  These special pattern-matching
characters are listed below.

Character        HP Browse Functionality 

^                Matches the beginning of a line when it is the first
                 character of a pattern.  Represents "Not in set" when it
                 is the first character after a left bracket, [.
                 Otherwise, HP Browse treats it literally.  That is, the
                 ^ character matches only other ^ characters.

$                Represents the end of a line when it is the last
                 character of a pattern.  Otherwise, it is treated
                 literally.

( )              Groups portions of a pattern.  The main use of
                 parentheses is with the vertical bar character.  You
                 must always specify at least one character between left
                 and right parentheses.

|                Separates multiple, distinct patterns in a list.
                 Matches any one of the patterns in the list.  The bar
                 character has special meaning only when used inside
                 parentheses, otherwise it is treated literally.  That
                 is, the | character outside of parentheses matches only
                 |.

[ ]              Indicates a set of characters.  HP Browse attempts to
                 match any one of the characters in the set.  You must
                 always specify at least one character between left and
                 right brackets.

Character        HP Browse Functionality 

-                Signifies a range of alphanumeric characters starting
                 with the character preceding the hyphen and ending with
                 the character following the hyphen.  The hyphen
                 character has special meaning only when used inside
                 brackets.  However, HP Browse will treat a hyphen
                 literally inside brackets if it is the first or last
                 character inside the brackets.

+                Matches one or more occurrences of the previous
                 character.

*                Matches zero or more occurrences of the previous
                 character.

?                Matches exactly one of any character.

?+               Matches one or more characters.

#                Matches exactly one of any digit.

@                Matches 0 or more number of unspecified characters.
                 (Equivalent to ?*).

\                Causes any subsequent character to be interpreted
                 literally.

If you want to search your file for occurrences of the word "BUF",
regardless of surrounding characters, you can simply type

BUFReturn 

after pressing the  Define Search function key.  The pattern "BUF"
contains no wildcard or pattern-matching characters.  It specifies only
the word "BUF".  However, using pattern-matching characters, you can
create many other search strings.  Some examples are shown below.

Syntax           Pattern Specified 

^The             Any line starting with the word "The".

\^The            The string "^The".

(a|[c-z]|[1-4])  A single character chosen from the following:  "a", the
                 range "c" to "z", or the range 1 to 4.

([A-Z])BUF       Any one capital letter followed by "BUF".

[A-Z]\(@\);      Any string starting with an uppercase alphabetic
                 character followed by an open parenthesis, any number of
                 characters, and a close parenthesis.  The entire string
                 must be terminated with a semicolon.

BUF+$            Any line ending with a string that begins with "BU",
                 followed by one or more occurrences of "F".

BUF*             The character string "BU" followed by zero or more
                 occurrences of "F".

???_BUF#         Any three characters followed by the string "_BUF"
                 followed by any one digit.

\@\?\\           The string "@?\".

Find Matching Delimiter 

If the cursor is on a parenthesis, brace, or bracket, you can use the
Find Matching Delimiter function to move the cursor to the matching
parenthesis, brace, or bracket if such a match exists.  For example, if
the cursor is on a close parenthesis character (")") and you want to find
the corresponding open parenthesis character ("("), simply press the  
Match Delimitr function key and HP Browse will move the cursor to the
matching delimiter if it exists.  If a matching delimiter does not exist,
HP Browse will tell you so and leave the cursor where it was when you
executed the function.

Find All Occurrences 

The Find All Occurrences function displays all the lines in a file
containing your search pattern.  It also enables you to move quickly to a
particular line containing your search pattern.  If you specify a count
when you use this function, HP Browse searches the next count lines
beginning with the current line.  If no count is given, HP Browse
searches the entire file.

If the pattern cannot be found during a Find All Occurrences search, HP
Browse displays "Not found." in the message line.  When a pattern is
found, HP Browse displays the first 19 lines containing the search
pattern.  (Note that if you press Control Y while the occurrence lines
are being printed, HP Browse terminates the search, leaving the lines it
has printed on the screen.)

[]
Figure 3-2. The Find All Occurrences Screen The search pattern is displayed on the second line of the screen in parentheses. If there is not enough room on the second line for the entire search pattern, HP Browse displays only the first 60 characters of the search pattern. HP Browse displays the corresponding line number with each line containing an occurrence of the search pattern. Standard line numbers are formatted in 10 columns; COBOL line numbers are formatted in eight columns. For unnumbered files, the record number is printed in the first six columns. A dollar sign at either end of an occurrence line indicates that the line is too long to be displayed on the text screen and has been truncated. If HP Browse finds multiple occurrences of the search pattern on a line and one or more is beyond the columns being displayed, additional lines are printed containing the same line number with the starting column number in brackets. At the prompt, you may press Return to go back to the line in the text window where the Find All Occurrences function was executed. To browse a specific matching line within the context of the text window, move the cursor to the desired matching line and then press either Return or the Move to Line function key. Pressing Control Y or the Stop Search function key while the cursor is anywhere on the Find All screen will display the text window positioned at the line where the Find All Occurrences function was executed. HP Browse can only display 19 matching lines at a time. If you execute the Find All function and HP Browse finds over 19 matching lines, they are displayed on multiple screens. Press Space Bar or the Next Page function key to display the next screen of matching lines.


MPE/iX 5.0 Documentation