GREP --
Find Regular Expressions in Files
Revision History
program and documentation by Stan Brown, Oak Road Systems
release 5.33, revised 19 August 2001
Copyright © 1986-2001 by
Stan Brown, Oak Road Systems
GREP is a filter that searches input files, or the standard input, for
lines that contain matches for one or more patterns called
regular expressions and displays those matching lines.
This document is the complete revision history, starting with the most
recent changes.
To use GREP, please see the user guide.
Release 5.33, 19 Aug 2001
This is a repackaging for Simtel; there are no significant functional
changes.
Release 5.32, 20 May 2001
If you specified current directory on another disk, such as "d:*.htm",
GREP was taking that as root directory, "d:\*.htm". Apparently no one
but the program author ever does such a thing!
Release 5.31, 18 April 2001
Unfortunately, a bug was introduced in release 5.3: under certain
circumstances, GREP got confused about whether it was working from
standard input or input files. This release corrects that bug, with my
apologies to everyone who downloaded the buggy 5.3.
Release 5.3, 17 April 2001
New features:
- The new
/Y
option lets you search
for lines that contain multiple regexes in any order.
- The
/D
option now allows the pseudo
filename "-", for debugging display on standard output.
- Options can now appear anywhere on the command
line, not just before the first file spec.
Other changes:
- If the regex began with a
single or double quote but did not end with one, GREP formerly assumed you
meant to put it in quotes but forgot the closing quote. Now, it
interprets the quote mark as the first character of the regex.
- If GREP detects an internal error, it returns 128 in
ERRORLEVEL
instead of 252.
- Two facilities for "canning" GREP parameters are now restricted to
the registered version of the program:
the environment variable and
multiple regexes from file. (Multiple
regexes can still be entered "live" at the
keyboard.)
- Some internal functions of the code were factored out into common
routines used by multiple Oak Road Systems programs. There should be
no significant change visible to users beyond the formatting of some
messages.
- For people who license the source code, the build procedure was
streamlined to use a single makefile.
Release 5.2, 4 Jan 2001
- In the user guide, split out the file input
options and pattern-matching options
from the big group of general options, and
provide a road map to the plethora of output
options.
- In the help message,
describe the /C option and
/V option a bit more explicitly,
arrange the options to match the functional groups in the user guide,
and add a tip about using
more
to paginate the message.
- In the list of option settings (displayed if you turn on the
/D option),
arrange the options to match the functional groups in the user guide,
add the relevant option letter to each setting,
and show the setting of the /1 or /0 option.
- Replace a lot of funky macros with more straightforward functions
for displaying diagnostic messages, and clarify the text of a few
messages.
- Tie certain features to the
registered version of GREP. Make the logo and the
debugging output reflect the
registration status.
Release 5.1, 31 May 2000
- fix a bug: a redundant *-expression preceding $ at the end of a regular
expression should have matched the end of line, but did not. Example: ab*$
would match ab, abb, abbb, etc. at end of line; but it did not
match an a at end of line, as it should have.
Release 5.0, 7 May 2000
Changes to the program:
- Add the
/R
option to read and
display files in binary mode
- Add the
/W
option to set the line width
(formerly fixed at 255 characters), and warn the user if longer lines
were found
- Add the
/Z
option to reset all
options
- Disallow out-of-order character ranges
like
z-a
; previously they were silently treated like the three
characters "z", "-", "a"
- Add new return values 2 and 252-254
- Expand the treatment of regular expressions in the
help message
- Send the help message to stdout instead of stderr
as previously
- Don't display the help screens when the user types
grep
with no options or regular expression; instead,
suggest using grep /? |more
- In debug mode, add more trace messages for opening input files
- When displaying a regular expression in debug mode, use a numeric
to show number of members in a character class
- Fix bug in 4.5: if you used wildcards with drive but no directory,
e.g.
d:*
, the drive was ignored
Changes to the user guide:
- Change file name to GREPUSER.HTM from GREP.HTM.
- Add an alphabetical index of options
- Add note about using double quotes around filenames that contain
spaces.
Release 4.5, 25 Sep 1999 (general release):
v4.4, 18 Sep 1999 (limited release):
- Add the
/S
option for searching subdirectories (4.4)
- Add the
/A
option
for searching hidden and system files (4.4)
- Add a section to the user guide to describe input
files and redirection (4.4)
- Fix a bug: on the command line, regular expressions like
[\244-\246\248-\255]
,
with adjacent escaped 8-bit character ranges, were not expanded
correctly (4.5)
- Systematize the debugging output somewhat, in the course of fixing the
preceding bug (4.5)
- Fix a bug: on the command line,
\e
in regular
expressions was expanded to
Control-W (octal 27) instead of Escape (decimal 27) (4.5)
- Clarify and expand
"Special rules for the command line"
section of the user guide,
clarify the descriptions of
the
/D
and /I
options,
and add quite a few internal hyperlinks (4.5)
Release 4.3, 4 Aug 1999
- Update contact information (new physical address and URL)
- Simplify registration options
- Add site license pricing
Release 4.2, 20 Feb 1999
- Allow 8-bit characters in regular expressions
- Allow multiple regular expressions to be typed in directly, with
the
/F-
option
- Fix a bug: with
/I
, character classes entered in
lower case were expanded incorrectly
Release 4.1, 22 Jan 1999
- Add the
/U
option (UNIX-style output) and the
/Q
option (quiet). Distinguish between option errors in
the environment variable and on the command line
- Make all output options toggles (except
/P
); diagnose conflicts
only after the last option has been scanned
- Take an optional output file name with
/D
(debug), which
is no longer a toggle
- Default
/P
(show context lines) to 2,2 if user specifies
/P
without numbers
- Honor the special escape sequences only
on the command line, since they're not needed when entering regular
expressions in a file
- Rewrite and greatly expand the user guide. Use HTML instead of MS
Word for Windows
Release 4.0, 19 Nov 1998
- Package the existing release 4.0 for shareware release: revise
documents without changing the software
Release 4.0, May 1998
- Add the
/F
option (multiple regular expressions in a
file)
- Build a 32-bit version (to accept long filenames) along with
the 16-bit version, using a single set of source files
Release 3.4, March 1998
- With the
/P
option, remove the < > widgets
around the line numbers of the context lines, so that the lines
that actually match are more easily seen
Release 3.3, Feb 1998
- Add the
/L
option
- Accept options from an environment variable
- In the output, show the file path as specified on the
command line, not just the filename
- Prefix program messages with "grep:" or "grep/debug:"
- Add warning messages for incompatible or redundant sets of options
- Diagnose a regular expression containing
empty brackets
[]
as a user error, not an internal error
- Remove the
/S
option (search subdirectories), because
GREP's code now uses the C run-time library to interpret file specs on
the command line
- Fix a bug: inside
[...]
in regular expressions, the
backslash was swallowing an extra character
Release 3.2, June 1997
- Add the
/0
and /1
options to control
exit status
/D
now shows the number of matches in each
file, total matches, and exit status
Release 3.1, Jan 1997
- Allow numeric escapes like
\0x9A
, \045
,
and \211
in the regular expression
Release 3.0, Dec 1996
- Add the
/P
option (show context lines around the
actual matches)
- Display the values of all options when
/D
is on the command line
Release 2.4, April 1990
- Add
+
in regular expressions (match one or more
occurrences)
- Allow options both before and after the regular expression
- Add the
/S
option (search subdirectories)
Release 2.3, March 1990
- Reverse the meaning of the
/B
option: now the default
is to show only the names of matching files
- Suppress "matched 0 lines" when
/C
(count matches) is
specified and /B
is not
- Fix a bug:
[...]
character classes containing the range
character -
weren't always expanded correctly
Release 2.2, Jan 1990
- Add the
/B
option (show only the names of files that
contain matches)
Release 2.1, Dec 1989
- Make the
/D
option show the input pattern as well as
the decoded version
- Fix a bug: character classes
[...]
weren't working with
the /I
option
Release 2.0, July 1989
- Complete rewrite
- Add the
/I
option (ignore case)
- In the regular expression, add
\e
(escape) and
\q
(equal sign)
Release 1.0, April 1986
- initial release (to clients only): Though all code was developed
independently, I got some ideas from PC Tech Journal, May
1996, pages 191-199.