" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#008000" VLINK="004000" ALINK="#00C000">
FIND COMMAND
Purpose: Searches for a specific text string in file(s).
Syntax: FIND [/C/D/I/L/N/R/U/V/W/Z] string
[drive:][path]filename [[drive:][path]filename ...]
Type: External command
Parameters:
The FIND parameters are one or several single characters, preceded by
the (/) character. Each character is a switch, that can be "switched on" and
"switched off". "Switching on" is done by the (+) character, "switching off"
is done by the (-) character. These characters follow the parameter of the
command line (for example, /R+ or /R-). If you do not specify the action
with the switch, it defaults to (+).
/C - is a counter: it displays the number of found strings. For each
file, in which the command finds the string, the filename and the
number of strings will be typed. The strings themselves won't be
typed.
/D - directories: For each filename, specified in the command line, the
FIND utility looks for all files with the same name both in the
specified directory and in all subdirectories of this directory. If
you specified the filename without the path, the FIND utility looks
for it in the current directory.
/I - ignore case.
/L - look through files that contain the string; FIND displays only names
of these files.
/N - display the found lines, together with their numbers.
/R - search for regular expressions. The text, defined as a string of
search, is considered to be a regular expression.
/U - the option of change: FIND joins options specified in the command
line with the default parameters and writes them all into the
FIND.COM file as new parameters values, used by default.
/V - Type only those strings, that do not contain the string of search.
/W - Word search: a text will be found, if the meaning of an expression
will match, and if the preceding and the following letters won't be
parts of a word. The set of characters for words contains A-Z, 0-9
and (_).
/Z - FIND types the filename for every found file. The number of a string
precedes every string. There is also a register with the number of
found strings in every file.
Description:
Please mind that, every parameter of the FIND utility is a switch. At
any time any parameter can be switched on or off. When the given parameter
appears in the command line, it cancels its former meaning. For example:
find /r+ /i /d- /i /r- main my *.asm
After entering this command line the FIND utility will be invoked with
the following parameters (/d - switched off, /i - switched on, /r - switched
off).
With the help of the /u parameter you can build in parameters, used by
default, in the FIND utility.
Search string:
The meaning of the search string defines a pattern, using which the
FIND utility makes its search. The search string can be either a regular
expression or a string of characters. A regular expression is a separate
character or a set of characters. Concatenation of regular expressions is a
regular expression. In regular expressions some characters have a special
purpose - they control the search. The string of characters has no operators
- every symbol is considered to be a character. The search string is
considered to be a regular expression when the FIND command is used with /r
parameter.
You should put the search string in quotation marks if it containes
spaces and tabulators, to avoide taking the latters as separators.
Operators in regular expressions
When you use the /r parameter, the search string is considered to be a
regular expression and the following characters have special purposes:
^ - at the beginning of the expression this character corresponds to
the beginning of the string.
$ - at the end of the expression this character corresponds to the end
of the string.
. - this character corresponds to any character.
* - the expression, after which this separator follows corresponds to
several occurences of this expression. For example, in <fo*> it
corresponds to <f>, <fo>, <foo> and etc., but it doesn't correspond
to <fa>.
+ - the expression after which this separator follows, corresponds to
one or more occurences of this expression. For example: <fo+>
corresponds to <fo>, <foo>, etc., but not to <f>.
\ - this symbol precedes the character, that FIND should look for.
File specification
The third part of the FIND command line is the definition of a file. It
tells the FIND utility in which files (groups of files) it should look for
the string. The definition of a file can be either the specified filename or
wildcard ("?" and "*" symbols). You can also specify the path, as the part
of the file definition. If the path is not specified, FIND looks for a
string in the current directory only.
Examples:
It is assumed that all the FIND parameters are "switched off"in the
following examples:
Example 1:
Command line: find start: *.asm
It will search for: start:
restart:
It won't search for: restarted:
ClockStart:
Where: In files with .ASM extension in the current
directory.
Note: Small and capital letters differ by default.
Example 2:
Command line: find /i /w word *.doc
It will search for: every new word must be on a new line
However, MY WORD !
word: smallest unit of speech which conveys meaning
In the beginning there was WORD, and the WORD
It won't search for: Each file has at least 2000 words.
He seems to continually misspell "toward"
as "toword."
Where: In *.DOS files in the current directory.
Note: This format defines global search of "words".
Example 3:
Command line: find "search string with spaces" *.doc
*.asm a:\work\myfile.*
It will search for: This is a search string with spaces in it
It won't search for: THIS IS A SEARCH STRING WITH SPACES IN IT
This is a search string with many spaces
in it.
Where: In *.DOS and *.ASM files in the current
directory and in MYFILE.* files in WORK
directory in the drive A.
Note: This is an example how you can search
for a string with spaces.
Example 4:
Command line: find /i /l /d " the " \*.doc
It will search for: Anyway, this is the time we have
do you think? The main reason we are
It won't search for: He said "Hi" to me just when I
Where are you going ? I'll bet you're
headed to
Where: In *.DOS files in the current directory
and in all subdirectories on the current
disk.
Note: Case-insensitive search. Any filenames,
containing at least one search string are
displayed.
Example 5:
Command line: find /r "^1.*" *.*
It will search for: All strings that have "1" as the first symbol
It won't search for: All strings, that have any symbol,
except "1" as the first one.
Where: In all *.DOS files in the current directory.