Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


MultiSearch

Script

SYNTAX

MultiSearch (pattern… | -f patternFile) (-t targetDir | -j targetDir)
[-i | -s] [-p] [-q | -v] [-rf | -rp]

DESCRIPTION

The MultiSearch script searches all text files in the specified directory or directory tree for one or more patterns. Any number of search patterns may be specified, either on the command line or in a text file.

A report is produced in one of three forms. The default output is the same as for the Search tool: a short MPW script containing File and Line commands followed by the found text shown as a comment. For example:

File "file"; Line n # displays the matching text pattern

Executing this command opens a window with the found text selected. Alternately, you can specify the -v option to display the found text on a seperate line, or the -q option to display only the found text.

The report is normally sorted by file. You can specify the -rp option to sort the report by search pattern instead.

If you need to know which files do not contain the search pattern, you can use the -p option to display a complete progress report, which includes this information.

INPUT

None.

OUTPUT

Standard output.

STATUS

MultiSearch can return the following status codes:

0

no error

1

syntax error

2

pattern not found

PARAMETERS

pattern

A list of one or more patterns or string literals to search for. Patterns may not be specified on the command line if the -f option is used.

OPTIONS

-f patternFile

Specifies a text file containing the patterns to search for. Patterns may not be specified on the command line if this option is used. The file should contain a space- or line-seperated list of patterns. Note that normal MPW quoting and pattern matching rules apply, for example:

fred joe
/arthur≈/

contains three patterns, 'fred', 'joe', and '/arthur≈/', while the following:

'fred joe'
/arthur≈/

contains two patterns, 'fred joe' and /arthur≈/

-i

Specifies that all matches are to be case-insensitive. By default, case sensitivity is determined by the value of the {CaseSensitive} shell variable.

-j targetDir

Specifies the directory to be searched. Nested directories will not be searched. You must specify this option or the -t option.

-p

Prints progress and copyright information. Included in the progress report is information on which files do not contain the search patterns.

-q

Specifies that the report should contain only the matched text, omitting the File and Line commands that identify where the text was found.

-rf

Groups the report by file. This is the default.

-rp

Groups the report by search pattern instead of by file.

-s

Specifies that all matches are to be case-sensitive. By default, case sensitivity is determined by the value of the {CaseSensitive} shell variable.

-t targetDir

Specifies the base directory to be recursively searched. All directories contained in this directory are also searched. You must specify this option or the -j option.

-v

Specifies that a verbose report should be generated. The matched text is shown on one line, and MPW commands to locate it are given on a separate line.

SEE ALSO

Search

 
 


Last Updated July 2000