GREP (Global Regular Expression Print) All "Borland" products install "Turbo Grep", an external program available from the command line. It is on your path. Grep is a fast utility that searches inside text files for specific strings of text. Turbo Grep can optionally search sub-directories; by default it searches the current directory only. You can redirect output to a file using stdout redirection ( > file.name) In a DOS box (command window) type to see the help: c:\> grep ? Turbo GREP 5.5 Copyright (c) 1992, 1998 Borland International Syntax: GREP [-rlcnvidzuwo] searchstring file[s] or @filelist Options are one or more option characters preceded by "-", and optionally followed by "+" (turn option on), or "-" (turn it off). The default is "+". -r+ Regular expression search -l- File names only -c- match Count only -n- Line numbers -v- Non-matching lines only -i- Ignore case -d- Search subdirectories -z- Verbose -e Next argument is searchstring -w- Word search -o- UNIX output format Default set: [0-9A-Z_] -u xxx Create a copy of grep named 'xxx' with current options set as default A regular expression is one or more occurrences of: One or more characters optionally enclosed in quotes. The following symbols are treated specially: ^ start of line $ end of line . any character \ quote next character * match zero or more + match one or more [aeiou0-9] match a, e, i, o, u, and 0 thru 9 ; [^aeiou0-9] match anything but a, e, i, o, u, and 0 thru 9 Examples grep -i Foo *.pas -- finds "foo" and "Foo" anywhere, and also "foolish..." grep -i Foo\( *.pas -- only finds function definitions and calls grep -i "Foo *\(" *.pas -- same but allows for optional space (* = 0 or more, + = 1 or more) before ( -- have to put search string in double quotes when it includes special characters such as spaces grep -iwn Foo *.pas -- whole word option is simpler and gives similar result. -- -n prints line numbers. -- Don't need "s grep -inw "unit4" *.pas -- find all mention of unit4, eg to find out what units reference other units grep ":= [0-9]+" *.pas -- find all constant assignments. 1 or more digits after := -- [-] defines a set of characters -- + = 1 or more occurences grep [1-9][0-9]* *.pas -- find all numbers greater than 0 -- hex constants: \$[0-9A-F]+ -- unescaped $ means end of line grep '.+' *.pas -- find all strings grep ^^// *.pas -- find all lines starting // from beginning of line -- need to double ^ as DOS must escape the ^ The reason I was using GREP recently was to: * find all text .dfm's in my projects which do NOT have Scaled = False -> best I can do is use grep -iz Scaled *.dfm > log.txt and look in log.txt for "0 lines matched" grep search expressions can also be used from the Find dialog. ** I don't know if the same grep parser is used by the Find and Turbo Grep. You would hope so! ** BUT there are Grep's and there are Grep's. Read the documentation, if any, or test carefully! Don't forget that GREP works on any text files (not just .pas's and .dfm's). So it is useful to search .htm(l) and other files, you may have. Richard King July 2009