GREP32 for WIN32 Version 1.1.0 June 28, 1995 This is a new version of GREP32.EXE for both Windows NT and Windows 95. For the first version I promised a future version with a GUI. Well, the GUI is still on my list of things to do. Disclaimer & Copyright: Copyright (C) 1995 MarcNET. All Rights Reserved. GREP32 is FreeWare!! THE INFORMATION AND CODE PROVIDED IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDIND DIRECT, INDIRECT, INCINENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Please send questions comments, suggestions to: Marc Geist 945 Sparta Drive Lafayette, CO 80026 303-538-2653 mag@dr.att.com History: 10-07-93 Version 1.0.0 First Released 06-26-95 Version 1.1.0 Released. Fixed problem where text in last line of file was not found if the last line was not properly terminated with a CR/LF. Improved methed of reading input files. Verified functionality with both Windows NT 3.51 and Windows 95 Final Beta. Quick overview of the GREP32 command line and regular expression syntax: Usage: grep [-bcilmnsvq? -dnnn] "pattern" file1 file2 ... [>ofile] [>>ofile] Options: b Each line is preceded by the block number of the file in which it is found. (based on 512 byte blocks). c Only print the number of lines matched. i Ignore the case of each character while matching. l Only list the names of files containing a match (or a nonmatch if 'v' option is selected). m Program prompts for search string (helps in search for ' and ") n Precede each printed line by its relative line number in the file. s Suppress all error messages produced by non-readable files. v All lines but those matching are printed. q Suppress header information in output. dnnn Dump nnn lines of text including the string match line. > Will create new version of output file. >> Will append to output file if it exists or will create it if it does not exist. ? Print this message plus more detailed information on options and pattern matching. If the 'm' option is specified, no search pattern is expected on command line. Wildcards in specified file names are supported via the functionality provided by \MSVCNT\LIB\SETARGV.OBJ (read your MSC documentaion for a description of this). Options can be placed anywhere on the command line and they are additive. The first occurance of an argument not preceded by '-' will be acknowledged as the pattern string to be searched for unless the 'm' option has been specified. Any other arguments not preceded by '-' will be taken as filenames. The minimum number of arguments must contain at least a pattern string and a filename or the 'm' option and a filename. If no options are specified the default condition is an exact pattern search in the filename(s) specified with all matching lines printed to the screen. How to construct special regular expression search patterns: Special Characters: * Wildcard that matches any character or number of characters. . (period) matches any one character. ^ (caret) at the beginning of a pattern constrains the pattern to a match the initial segment of a line. $ (currency sign) at the end of a pattern constrains the pattern to a match the final segment of a line. [ Used to "begin-block" a string of characters for special one- character matches. ] Used to "end-block" a string of characters for special one- character matches. \ Backslash followed by any special character will match that special character (i.e. "\[" will match the character '['). Special Constructs: [str] A non-empty string of characters enclosed by square brackets will match any one character in the string. [^str] A non-empty string of characters enclosed by square brackets and preceded by a "caret" will match any character except the characters in the string. - (hyphen) may be used to indicate a range of consecutive ascii characters (i.e [0-9] = [0123456789]. The '-' loses its special meaning if it occurs after an initial '^' or is located last in the string. \{m\} \{m,\} \{m,n\} A one character expression followed by \{m\}, \{m,\}, or \{m,n\} is an expression that matches a range of occurances of the one character expression. Values of m and n must be non-negative integers less than 256. \{m\} matches exactly m occurances, \{m,\} matches at least m occurances, and \{m,n\} matches any range of occurances between m and n inclusive. \(expression\) An expression enclosed between \( and \) is an expression that matches whatever the unadorned expression matches. \n The expression \n matches the same string of characters as was matched by an expression enclosed between \( and \) earlier in the same expression. n is a digit and the sub- expression specified is associated with the n-th occurance of \( counting from the left. For example the expression: \(test\).*\1 matches a line containing at least two occurances of the string "test". A concatenation of expressions is an expression that matches the con- catenation of the strings matched by each component of the expression.