HP Search/XL User's Guide

2- 13
:HPSEARCH "PARSC FOR READ WRITE OPEN CLOSE"
Every line of PARSC that contains one or more of these patterns is displayed.
Redoing a Search
Whenever you search files with HP Search, the names of all files searched are written to a file. All the
patterns searched for are also written to a file. By default, the files searched are written to the temporary
file SRCHLOG, and the patterns are written to the temporary file SRCHPAT. You can use these files to
search the same set of files for a different pattern, or to search a different file for the same patterns. (See
also the SEARCHLOG and PATTERNLOG options in Chapter 3.)
The following two commands search the same set of files: all the files in the groups SOURCE and PUB.
The first command searches for the pattern READ, and the second command searches for the pattern
WRITE. The second command uses the temporary file SRCHLOG to specify the files to search:
:
HPSEARCH "@.SOURCE @.PUB FOR READ"
:
HPSEARCH "^SRCHLOG FOR WRITE"
The following two commands search two different files, named INPUT1 and INPUT2, for the same
patterns: AFTER, BEFORE, and ADVANCING. The second command uses the temporary file SRCHPAT
to specify the pattern:
:HPSEARCH "INPUT1 FOR AFTER BEFORE ADVANCING"
:
HPSEARCH "INPUT2 FOR ^SRCHPAT"
Making the Pattern More Specific or Less Specific
The following command searches the file named SALARY for the pattern "Nov 1987". The single quotes
are required to inform HP Search that "Nov 1987" is one pattern, rather than two separate patterns:
:HPSEARCH "SALARY FOR 'Nov 1987'"
The following command makes the search less specific. HP Search searches for the pattern "1987":
:
HPSEARCH "SALARY FOR 1987"
The following command makes the search more specific. HP Search searches for the pattern "(1[6-9]|20)
Nov 1987". This represents the dates 16 November 1987 through 20 November 1987:
:
HPSEARCH "SALARY FOR '(1[6-9]|20) Nov 1987'"
Sending Output to a File
You can send the output from HP Search to a file by using the LIST option. The following example
searches the file DATA for the pattern HOUR and writes the output to both $STDLIST and the file
DATALIST. (Use the QUIET option to stop output to $STDLIST.) If the file DATALIST already exists, HP
Search prompts you before overwriting it.
:
HPSEARCH "DATA FOR HOUR WITH LIST DATALIST"
If the file DATALIST already exists, the REPLACE argument of the LIST option suppresses the prompt.
The following command repeats the previous search and overwrites DATALIST without prompting you for
permission.
:HPSEARCH "DATA FOR HOUR WITH LIST DATALIST REPLACE"