HELP SEARCH — VMS 5.5-2H4
Searches one or more files for the specified strings and displays
those lines containing those strings.
Format
SEARCH filespec[,...] search-string[,...]
Additional information available:
PARAMETERS
filespec[,...]
Specifies one or more files to be searched. You must specify
at least one file name. If you specify more than one file name,
separate them with commas (,).
Wildcard characters are allowed in the file specification.
search-string[,...]
Specifies the character string to be located in the specified
files. Enclose strings containing lowercase letters, blanks, or
other nonalphanumeric characters (including spaces) in quotation
marks (" ").
You can use the /MATCH and /EXACT qualifiers to alter the way that
SEARCH matches search strings.
QUALIFIERS
Additional information available:
/BACKUP/BEFORE/BY_OWNER/CONFIRM/CREATED/EXACT
/EXCLUDE/EXPIRED/FORMAT/HEADING/HIGHLIGHT/LOG
/MATCH/MODIFIED/NUMBERS/OUTPUT/REMAINING/SINCE
/STATISTICS/WINDOW
/BACKUP
Modifies the time value specified with the /BEFORE or the /SINCE qualifier. The /BACKUP qualifier selects files according to the dates of their most recent backups. This qualifier is incompatible with the following qualifiers that also allow you to select files according to time attributes: /CREATED, /EXPIRED, and /MODIFIED. If you specify none of these four time qualifiers, the default is the /CREATED qualifier.
/BEFORE
/BEFORE[=time]
Selects only those files dated prior to the specified time.
You can specify time as an absolute time, as a combination of
absolute and delta times, or as one of the following keywords:
TODAY (default), TOMORROW, or YESTERDAY. Specify one of the
following qualifiers with the /BEFORE qualifier to indicate the
time attribute to be used as the basis for selection: /BACKUP,
/CREATED (default), /EXPIRED, or /MODIFIED.
For complete information on specifying time values, see the VMS
DCL Concepts Manual.
/BY_OWNER
/BY_OWNER[=uic]
Selects only those files whose owner user identification code
(UIC) matches the specified owner UIC. The default UIC is that of
the current process.
Specify the UIC by using standard UIC format as described in the
VMS DCL Concepts Manual.
/CONFIRM
/CONFIRM
/NOCONFIRM (default)
Controls whether a request is issued before each search operation
to confirm that the operation should be performed on that file.
The following responses are valid:
YES NO QUIT
TRUE FALSE Ctrl/Z
1 0 ALL
<Return>
You can use any combination of uppercase and lowercase letters
for word responses. Word responses can be abbreviated to one or
more letters (for example, T, TR, or TRU for TRUE), but these
abbreviations must be unique. Affirmative answers are YES, TRUE,
and 1. Negative answers include: NO, FALSE, 0, and pressing
the Return key. Entering QUIT or pressing Ctrl/Z indicates that
you want to stop processing the command at that point. When you
respond by entering ALL, the command continues to process, but no
further prompts are given. If you type a response other than one
of those in the list, DCL issues an error message and redisplays
the prompt.
/CREATED
/CREATED (default)
Modifies the time value specified with the /BEFORE or the /SINCE
qualifier. The /CREATED qualifier selects files based on their
dates of creation. This qualifier is incompatible with the
following qualifiers that also allow you to select files according
to time attributes: /BACKUP, /EXPIRED, and /MODIFIED. If you
specify none of these four time qualifiers, the default is the
/CREATED qualifier.
/EXACT
/EXACT
/NOEXACT (default)
Controls whether the SEARCH command matches the search string
exactly or treats uppercase and lowercase letters as equivalents.
By default, SEARCH ignores case differences in letters.
Specifying the /EXACT qualifier causes the system to use less CPU
time. Therefore, if you are sure of the case of the letters in the
string, it is more efficient to use the /EXACT qualifier.
/EXCLUDE
/EXCLUDE=(filespec[,...])
Excludes the specified files from the search operation.
You can include a directory but not a device in the file
specification. Wildcard characters (* and %) are allowed in the
file specification. However, you cannot use relative version
numbers to exclude a specific version. If you specify only one
file, you can omit the parentheses.
/EXPIRED
Modifies the time value specified with the /BEFORE or the /SINCE qualifier. The /EXPIRED qualifier selects files according to their expiration dates. (The expiration date is set with the SET FILE /EXPIRATION_DATE command.) The /EXPIRED qualifier is incompatible with the following qualifiers that also allow you to select files according to time attributes: /BACKUP, /CREATED, and /MODIFIED. If you specify none of these four time qualifiers, the default is the /CREATED qualifier.
/FORMAT
/FORMAT=option
Formats output in one of the following five ways:
DUMP Displays all control characters (including <HT>, <CR>,
and <LF>) and nonprintable characters as ANSI mnemonics.
NONULLS Same as DUMP, but removes all null characters from the
input file before reformatting. (In dump mode, the null
character is displayed as <NUL>.) NONULLS is convenient
when you are searching binary format files, such as EXE
or OBJ files, that generally contain many zero bytes.
NOFF Replaces control characters in text with ANSI mnemonics
(for example, Ctrl/C is replaced with <ETX>). The
terminal formatting characters <HT>, <CR>, <LF>, <VT>
are passed without change. Form feed characters are
replaced with <FF>.
PASSALL Moves control and nonprintable characters to the output
device without translating them. The terminal driver
cannot send 8-bit characters to the terminal unless
either SET TERMINAL/PASSALL or SET TERMINAL/EIGHT_BIT is
already in effect.
You can use /FORMAT=PASSALL whenever you do not want
the SEARCH command to substitute the ANSI mnemonic for
control characters (for example, <BEL> for Ctrl/G).
TEXT Replaces control characters in text with ANSI mnemonics
(for example, Ctrl/C is replaced with <ETX>). The
terminal formatting characters <HT>, <CR>, <LF>, <VT>,
and <FF> are passed without change.
TEXT is the default format.
/HEADING
/HEADING (default)
/NOHEADING
Includes file names in the output file and displays a line of 30
asterisks (*) as a window separator between groups of lines that
belong to different files. With the default heading format, file
names are printed only when more than one file is specified or
when wildcard characters are used.
The /WINDOW qualifier displays a line of 15 asterisks separates
each window within a file.
/HIGHLIGHT
/HIGHLIGHT
/HIGHLIGHT(=option)
/HIGHLIGHT=BOLD (default on ANSI video terminals with advanced
video)
/HIGHLIGHT=REVERSE (default on ANSI video terminals without
advanced video)
/NOHIGHLIGHT (default for all other output)
Controls whether the actual strings that are matched are
emphasized in the output. The emphasis, or highlighting, can be
one of several options:
BLINK The matched strings are highlighted using the
ANSI blink character attribute (advanced video
only).
BOLD The matched strings are highlighted using the
ANSI bold character attribute (advanced video
only). If the /HIGHLIGHT qualifier is used
without an option, BOLD is assumed.
REVERSE The matched strings are highlighted with the
ANSI underline video attribute (possible without
advanced video).
UNDERLINE The matched strings are highlighted with the
ANSI underline video attribute (possible without
advanced video). Without the advanced video
option, either REVERSE or UNDERLINE will appear
depending on whether the cursor is selected as
block or underline. The two options REVERSE and
UNDERLINE have the same effect.
HARDCOPY(=option)This specifies that the strings should be
highlighted in a manner suitable for most
hardcopy printers. Hardcopy highlighting has
two options: OVERSTRIKE and UNDERLINE. With
overstrike highlighting, matched strings are
double-printed, so that they appear darker.
The matched strings are underlined with the
underscore character.
Hardcopy printing is accomplished by adding a
carriage return and spacing back over the line
to overprint the string or underlines. Note
that this can as much as double the length of
the line, and perhaps lead to truncation if the
device buffer size is too small.
Digital recommends that you use
the /HIGHLIGHT=UNDERLINE qualifier with
the Digital LN01 printer instead of the
/HIGHLIGHT=HARDCOPY=UNDERLINE qualifier. The
LN01 printer ignores OVERSTRIKE highlighting.
Digital recommends that you use either the
/HIGHLIGHT=BOLD or the /HIGHLIGHT=UNDERLINE
qualifier with the Digital LN03 printer instead
of the /HIGHLIGHT=HARDCOPY=UNDERLINE qualifier.
The LN03 printer ignores OVERSTRIKE highlighting.
/LOG
/LOG
/NOLOG (default)
Outputs a message to the current SYS$OUTPUT device for each
file searched. The message includes the file name, the number
of records, and the number of matches for each file searched.
/MATCH
/MATCH[=option]
Interprets and matches multiple search strings in one of the
following ways:
AND A match occurs only if the record contains all the
strings.
NOR A match occurs only if the record contains none of the
strings.
NAND A match occurs only if the record does not contain all of
the strings.
OR A match occurs if the record contains any of the strings.
When only one search string is specified, the OR and AND options
produce identical results. Similarly, NOR and NAND produce
identical results for a single search string.
If you specify none of these options, the default is /MATCH=OR.
/MODIFIED
Modifies the time value specified with the /BEFORE or the /SINCE qualifier. The /MODIFIED qualifier selects files according to the dates on which they were last modified. This qualifier is incompatible with the following qualifiers that also allow you to select files according to time attributes: /BACKUP, /CREATED, and /EXPIRED. If you specify none of these four time modifiers, the default is the /CREATED qualifier.
/NUMBERS
/NUMBERS
/NONUMBERS (default)
Controls whether the source line number is displayed at the left
margin of each line in the output.
/OUTPUT
/OUTPUT[=filespec]
/NOOUTPUT
Controls whether the results of the search are output to a
specified file. The output is sent to the current default output
device (SYS$OUTPUT) if you omit the /OUTPUT qualifier or omit the
file specification with the qualifier. The /NOOUTPUT qualifier
means that no matching records are output as a result of the
SEARCH command.
/REMAINING
/REMAINING
/NOREMAINING (default)
Includes in the output all records from the first matched record
to the end of the file. This qualifier overrides the value n2 in
the /WINDOW qualifier, but allows the qualifier /WINDOW=n1.
/SINCE
/SINCE[=time]
Selects only those files dated after the specified time. You can
specify time as an absolute time, a combination of absolute and
delta times, or as one of the following keywords: TODAY (default),
TOMORROW, or YESTERDAY. Specify one of the following qualifiers
with the /SINCE qualifier to indicate the time attribute to be
used as the basis for selection: /BACKUP, /CREATED (default),
/EXPIRED, or /MODIFIED.
For complete information on specifying time values, see the VMS
DCL Concepts Manual.
/STATISTICS
/STATISTICS
/NOSTATISTICS (default)
Controls whether the following statistics about the search are
displayed:
o Number of files searched
o Number of records searched
o Number of characters searched
o Number of records matched
o Number of lines printed
o Buffered I/O count
o Direct I/O count
o Number of page faults
o Elapsed CPU time
o Elapsed time
/WINDOW
/WINDOW[=(n1,n2)]
/NOWINDOW (default)
Specifies the number of lines to be displayed with the search
string. If you specify n1 and n2, the /WINDOW qualifier displays
n1 lines above the search string, the search string, and n2 lines
below the search string. Either of these numbers can be zero.
If you specify the /WINDOW qualifier without the values n1 and n2,
two lines above the search string, the search string, and the two
lines below the search string are included in the output.
If you specify the /WINDOW qualifier with a single number (n1), n1
specifies the number of lines to display including the search
string. Half the lines precede the matched search string and
half follow it. (If n1 is even, one line is added to the lines
following the matched search string.)
For example, if you specify /WINDOW=10, nine additional lines
are listed along with the line containing the search string. Four
lines are listed above the line containing the search string and
five lines are listed below it, for a total of 10 lines.
If you specify /WINDOW=0, the file name of each file containing
a match (but no records) is included in the output. This
specification creates a file (using the /OUTPUT qualifier) that
can be inserted into a command file to manipulate the files
containing matches.
If you omit the /WINDOW qualifier, only the line containing a
match is displayed.
Examples
1. $ SEARCH CABLE.MEM,JOYNER.MEM "MANUAL TITLE"
This command searches the files CABLE.MEM and JOYNER.MEM for
occurrences of the character string MANUAL TITLE. Each line
containing the string is displayed at the terminal. It is
necessary to enclose the string in quotation marks because
it contains a space character.
2. $ SEARCH/OUTPUT=RESULTS.DAT/WINDOW=9 DISLIST.MEM NAME
The SEARCH command searches the file DISLIST.MEM for
occurrences of the character string NAME and sends the output
to the file RESULTS.DAT. The four lines preceding and following
each occurrence of NAME are included in the output.
3. $ SEARCH/OUTPUT=ALLSUB.COM/WINDOW=5000 *.COM SUBMIT
The SEARCH command searches all command files in the current
directory for the string SUBMIT. If a match is found, SEARCH
effectively copies the entire command file to the output file,
because the window is so large.
4. $ SEARCH/OUTPUT=COLUMBUS.OH/WINDOW=(3,0)/NOHEAD/MATCH=AND -
_$ *.DAT COLUMBUS,OH
The SEARCH command searches all files of type DAT for lines
containing both COLUMBUS and OH. When a match is found, the
three previous lines (containing blank line, name, and street
address) are copied to the new file. The new file COLUMBUS.OH
is ready to use, because it does not contain headings and
window separators.
5. $SEARCH/OUTPUT=SWAP.LIS/FORMAT=PASSALL/NUMBERS/EXACT -
_$ /WINDOW=10000 SWAP.PAS SWAP
This SEARCH command produces a listing file with the line
numbers at the left margin. The /FORMAT=PASSALL qualifier is
specified so that form-feed characters in the source are passed
through. The /EXACT qualifier is specified for efficiency
(because it is known that the name SWAP in the program
statement is always in uppercase). The /WINDOW qualifier is
entered so that the entire file is copied to the output file
SWAP.LIS.
6. $ SEARCH/REMAINING CABLE.LOG FORTRAN
The SEARCH command displays all the lines in the CABLE.LOG file
that follow the first occurrence of the string FORTRAN.
7. $ SEARCH OMAHA::DISK1:[EXP]SUB.DAT,DATA.LIS VAX
The SEARCH command searches through the files SUB.DAT and
DATA.LIS at remote node OMAHA for all occurrences of the string
VAX. The list of all records containing the string VAX is
displayed at the local terminal.