help for find

Find specified text in multiple files


find [filenames] [, match(string) show zero ]

+-------------+ ----+ Description +------------------------------------------------------

find looks for matching strings across multiple files in the current directory (pwd). File names that contain an asterix are expanded into lists of files following dir. If no files are specified, find looks for matching strings across all files in the current working directory (see also pwd and cd). Depending on your operating system, you may prefer grep (*nix), find or findstr (Windows/DOS), or mdfind (Mac).

+----------+ ----+ Examples +---------------------------------------------------------

Cut and paste the entire block of example code to the Command window, or click on commands one by one to run:

cd `c(sysdir_base)'a loc t : dir . file "*.ado" find `t', m(version 8) s find, m(version 8) find *.class

+-----------------+ ----+ Options summary +--------------------------------------------------

match(string) specifies the string to look for.

show asks for lines in which the string occurs to be echoed to the screen. Line numbers are also shown, and single quotes (ASCII codes 96 and 39) are converted into similar-looking but meaningless single quotes (ASCII codes 145 and 146, respectively). See also display and smcl.

zero specifies that file names in the filenames list with zero matches should also be listed.


Austin Nichols Urban Institute Washington, DC, USA austinnichols@gmail.com

Also see

On-line: help for type, findfile, file, filefilter, hexdump, pwd, cd, dir, etc.