HELP SEARCH — VMS 5.0
Searches one or more files for the specified string or strings and
lists all the lines containing occurrences of the strings.
Format:
SEARCH file-spec[,...] search-string[,...]
Additional information available:
ParametersCommand QualifiersExamplesNew V5 Features
Parameters
file-spec[,...] Specifies the names of one or more files to be searched. You must specify at least one file name. If you specify two or more file names, separate them with commas. Wildcard characters are allowed in the file specification. search-string[,...] Specifies one or more strings to search for in the specified files. If the search string contains any lowercase letters or nonalphanumeric characters (including spaces), enclose it in quotation marks. You can use the /MATCH and /EXACT qualifiers to alter the way that SEARCH matches search strings.
Command 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
/BACKUP Selects files according to the dates of their most recent backup. This qualifier is only relevant when used with the /BEFORE or /SINCE qualifier. Use of the /BACKUP qualifier is incompatible with /CREATED, /EXPIRED, and /MODIFIED. The default is /CREATED.
/BEFORE
/BEFORE[=time] Selects only those files that are dated before the specified time. You can specify either an absolute time or a combination of absolute and delta times. See the VMS DCL Concepts Manual for complete information on specifying time values. You can also use the keywords TODAY, TOMORROW, and YESTERDAY. If no time is specified, TODAY is assumed.
/BY_OWNER
/BY_OWNER[=uic] Selects one or more files only if their owner user identification code (UIC) matches the specified owner UIC. Specify the UIC using standard UIC format as described in the VMS DCL Concepts Manual. If the /BY_OWNER qualifier is specified without a UIC, the UIC of the current process is assumed.
/CONFIRM
/CONFIRM
/NOCONFIRM (default)
Controls whether a request is issued before each individual TYPE
operation to confirm that the operation should be performed on that
file.
When the system issues the prompt, you can issue any of the
following responses:
YES NO QUIT
TRUE FALSE <CTRL/Z>
1 0 ALL
<RET>
You can use any combination of upper- and lowercase letters for word
responses. Word responses can be abbreviated to one or more letters
(for example, T, TR, or TRU for TRUE). Affirmative answers are YES,
TRUE, and 1. Negative answers are NO, FALSE, 0, and <RET>. QUIT or
CTRL/Z indicates that you want to stop processing the command at
that point. When you respond with 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, the prompt will be reissued.
/CREATED
/CREATED (default) Selects files based on their dates of creation. This qualifier is relevant only when used with the /BEFORE or /SINCE qualifier. Use of the /CREATED qualifier is incompatible with /BACKUP, /EXPIRED, and /MODIFIED.
/EXACT
/EXACT /NOEXACT (default) Controls whether the SEARCH command matches the search string exactly, or treats uppercase and lowercase letters as equivalents. The default qualifier, /NOEXACT, causes SEARCH to ignore 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 /EXACT.
/EXCLUDE
/EXCLUDE=(file-spec[,...]) Any files that match the listed file specifications are excluded from the TYPE operation. If you specify only one file, you can omit the parentheses. Wildcard characters are supported for file specifications. However, you cannot use relative version numbers to exclude a specific version. The file specification can contain a directory specification, but you cannot include the device in the file specifications you supply with the /EXCLUDE qualifier.
/EXPIRED
/EXPIRED Selects files according to the dates on which they will expire. This qualifier is relevant only when used with the /BEFORE or /SINCE qualifier. Use of the /EXPIRED qualifier is incompatible with /BACKUP, /CREATED, and /MODIFIED. The default is /CREATED.
/FORMAT
/FORMAT=option
Controls reformatting of records during output. You can specify one
of the following formatting options:
TEXT Replaces control characters in the 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.
NOFF Replaces control characters in the text with ANSI
mnemonics (for example, CTRL/C is replaced with <ETX>).
The terminal formatting characters <HT>, <CR>, <LF> and
<VT> are passed without change. Form feeds are replaced
with <FF>. It is otherwise identical to TEXT.
/FORMAT=NOFF is useful to prevent form feeds from breaking
up the output file, for example when a match finds a head-
ing in a listing file.
PASSALL Moves characters to the output device with no translation
whatsoever. 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). The terminal driver cannot send eight-bit
characters to the terminal unless either SET
TERMINAL/PASSALL or SET TERMINAL/EIGHT_BIT is already in
effect.
DUMP DUMP format is very similar to TEXT format. However, with
DUMP format, all control characters (including <HT>, <CR>,
and <LF>) are displayed as ANSI mnemonics.
NONULLS NONULLS is identical to the DUMP option, except that all
null characters are removed 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.
/HEADING
/HEADING (default) /NOHEADING Controls whether file names and window separators are printed in the output. With the default heading format, file names are printed only when more than one file is specified or when wildcard characters are used. The separator, a line of 30 asterisks, is displayed between groups of lines that belong to different files. If you specify the /WINDOW qualifier, a line of 15 asterisks separates each window within a file.
/HIGHLIGHT
/HIGHLIGHT(=option)
/HIGHLIGHT=BOLD (default on ANSI video terminal with advanced video)
/HIGHLIGHT=REVERSE (default on ANSI terminal without advanced video)
/NOHIGHLIGHT (default for all other output)
Controls whether the actual strings which 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 /HIGHLIGHT is used without an option, BOLD is assumed.
REVERSE The matched strings are highlighted using the ANSI reverse
video attribute. (possible without advanced video)
UNDERLINE The matched strings are highlighted with the ANSI under-
line video attribute. (possible without advanced video)
(Note that 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 With overstrike highlighting, matched strings
are double-printed, so that they should appear
darker.
UNDERLINE 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 trun-
cation if the device buffer size is too small.
The DIGITAL LN01 printer understands the ANSI video UNDERLINE attri-
bute, it is therefore recommended that /HIGHLIGHT=UNDERLINE be used
with this printer instead of /HIGHLIGHT=HARDCOPY=UNDERLINE. The LN01
does not understand OVERSTRIKE highlighting, and ignores it.
The DIGITAL LN03 printer understands both the ANSI video BOLD and
UNDERLINE attributes, it is recommended that either /HIGHLIGHT=BOLD
or /HIGHLIGHT=UNDERLINE be used with this printer instead of the
/HIGHLIGHT=HARDCOPY=UNDERLINE. The LN03 does not understand the
OVERSTRIKE highlighting, and ignores it.
/LOG
/LOG /NOLOG (default) Controls whether the SEARCH command produces a line containing the file name and the number of records and matches for each file searched. The log information is output to the current SYS$OUTPUT device.
/MATCH
/MATCH=option
Indicates how the SEARCH command matches multiple search strings.
The /MATCH qualifier has four options:
OR A match occurs if a record contains any of the search
strings.
AND A match occurs if and only if all of the search strings
are present in the single record.
NOR The negation of AND. A match occurs only if the record
does not contain any of the search strings.
NAND The negation of OR. A match occurs only if the record
does not contain all of the search 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.
/MODIFIED
/MODIFIED Selects files according to the dates on which they were last modified. This qualifier is relevant only when used with the /BEFORE or /SINCE qualifier. Use of the /MODIFIED qualifier is incompatible with /BACKUP, /CREATED, and /EXPIRED. The default is /CREATED.
/NUMBERS
/NUMBERS /NONUMBERS (default) Controls whether the source line number is displayed at the left margin of each line.
/OUTPUT
/OUTPUT[=file-spec] /NOOUTPUT Controls whether the results of the search are output to a specified file. The output will be 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) Controls whether the SEARCH command displays all records from the first matched record to the end of the file. The /REMAINING qualifier overrides the /WINDOW=n2 qualifier. However, you can still use the /WINDOW=n1 qualifier to specify the number of lines to be printed above the line containing the matched record.
/SINCE
/SINCE[=time] Selects only those files that are dated after the specified time. You can specify either an absolute time or a combination of absolute and delta times. See the VMS DCL Concepts Manual for complete information on specifying time values. You can also use the keywords TODAY, TOMORROW, and YESTERDAY. If no time is specified, TODAY is assumed.
/STATISTICS
/STATISTICS /NOSTATISTICS (default) Controls whether SEARCH displays statistics about the search. The statistics displayed are: 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) Controls the number of lines that are listed along with the line containing the matching string. If you specify the /WINDOW qualifier with a single number n, n-1 additional lines are displayed with each line containing the search string. Half of the additional lines are listed above the line containing the match, and half are listed below. If n-1 is an odd number, the extra line is listed below the 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, making a total of ten lines. If you specify /WINDOW without specifying a number, the default number of five lines---two above, one containing the search string, and two below---is used. If the form /WINDOW=(n1,n2) is used, n1 refers to the number of lines above the matched line and n2 refers to the number of lines below. Either of these numbers can be zero. If /WINDOW=0 is specified, SEARCH will display the file name of each file containing a match, but no records. You can use this specification to create 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 entirely, only the line in which the match is satisfied 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 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.
New V5 Features
For VMS V5, SEARCH supports longer input record sizes, up to 32768 bytes (instead of 2048 bytes). A new qualifier /HIGHLIGHT has been added to highlight any search strings which are found. See help on /HIGHLIGHT for details. A new output format of /FORMAT=NOFF has been added to avoid unnecessary form feeds when a matched line contains a form feed. See help on /FORMAT for details.