GREPFV version 10 by Nigel Salt (c) 15 March 1994
====================================================

Description
===========

GREPFV is a text string searching utility with a difference. It
searches for regular expressions in text files, archived files,
and executable files. It will automatically unarchive ZIP, PAK,
ZOO, LZH, ARJ and ARC files providing that you have a copy of
FV.COM and the necessary archive managers in your path.

Encrypted archives are not supported. The output from grepfv will
be a FAILED line for each encrypted file in an archive.

FV.COM is Vernon Buerg's addon for LIST. It is available on most
BBSs and several internet sites. More recent versions have been
distributed in the list archive. The latest version of list that
I have seen at the time of writing is in list90.zip or
list90.exe. The latter is a self extracting version.

The archivers required are
ARC       arc.exe (A copy of pak.exe renamed to arc.exe will do)
ZOO       zoo.exe
LZH       lharc.exe
PAK       pak.exe
ZIP       pkunzip.exe
ARJ       arj.exe

The syntax for grepfv is

grepfv [@optfile] [options] "regexp" filepattern[+] [tempdir]

Parameters in [] are optional

where

@optfile
       reads parameters from optfile
       THIS MUST BE THE FIRST OPTION

OPTIONS

-o     outfile
       outputs the results to 'outfile' as well as the screen

-x     REGEXP

       excludes all files whose name match 'REGEXP'. This will
       affect files in archives too.

       -x "*\.com"

       would exclude all all files with .COM in their names.

       You may have as many -x options as memory allows.
       THE & AND | REGEXP OPTIONS ARE NOT SUPPORTED

-i     REGEXP

       includes only files whose name matches 'REGEXP'. This will
       affect files in archives too.

       -i "*\.txt"

       would include only files with .COM in their names.

       You may have as many -i options as memory allows.
       THE & AND | REGEXP OPTIONS ARE NOT SUPPORTED

REGEXP is a pattern made up of ASCII characters plus the
following special "wild cards". Enclose the pattern in quotes to
avoid DOS misunderstanding the special characters. Searching for
a backslash poses particular problems because DOS treats it as an
escape character. To look for a backslash you actually have to
specify "\\\\" as the pattern. DOS then translates this to "\\"
which causes grepfv to look for a literal backslash.

All searches are case insensitive so "nIgel", "NIGEL", and
"Nigel" all match the expression "nigel".

REGULAR EXPRESSIONS:

\     treat next char as literal
.     match any single character
*     match 0 or more characters
&     preceeding expression AND following expression
|     preceeding expression OR following expression

FILEPATTERN is a dos type file specification including wildcards.
If you want to search all of the files in a directory then end
the filepattern with a \. If you want to search all of the files
in subdirectories too then add a + to the end of the filepattern.
For example "\ns\" searches all files in the \ns directory,
"\ns\nigel.*" searches all files in the \ns directory that are
called nigel, "\ns\nigel.*+" searches all files called nigel in
the \ns directory and all of its subdirectories.

If an archive matches the FILEPATTERN then all files in the
archive will be searched unless one of the exclude options
eliminates them.

TEMPDIR should preferably be a RAM disc. It is the location that
grepfv will use to temporarily explode the files in the archives
which it searches. The temporary directory must be on a drive
with enough free space to hold the largest file in the archive.

Examples
========

1. grepfv "vga" tools.zip f:

Searches all of the files in tools.zip for vga and uses drive f
for temporary files

2. grepfv "cga|vga" \tools\

Searches all files in the directory \tools of the current drive
for cga or vga using the current drive for temporary files
because no alternative was specified. Note the trailing backslash
on tools; without it grepfv would look for a file called tools in
the root directory.

3. grepfv "cga&vga" \tools\+

Searches all of the files in tools and its subdirectories for
line which contain both the word cga and vga.

4. grepfv -x "\.COM" -x "\.EXE" "nigel" *.*>c:\ns\grep.out

Searches all files in the current directory for the string
"nigel" except those files with .COM or .EXE in the file name.
The output is redirected to the file c:\ns\grep.out.

You can see the results on the screen and save them to a file
using the -o option like this:
  grepfv -o grep.out -x "\.COM" -x "\.EXE" "nigel" *.*

DO NOT REDIRECT TO AN OUTPUT FILE THAT COULD BE INCLUDED IN THE
SEARCH. IF YOU DO THEN GREPFV WILL BEGIN SEARCHING ITS OWN
RESULTS AND THE OUTCOME WILL BE INDETERMINATE.


5. grepfv "nigel" n*.*|more

Searches all files beginning with n in the current directory for
the string "nigel" and presents the result one screen at a time
by piping the output to the DOS more program.

6. grepfv -i "gr*\.txt" -i "zip" "nigel" *.zip

Searches all ZIP archives in the current directory. Only archived
files whose names begin with "gr" and end ".txt" will be searched
for "nigel". All other files will be excluded. Note the need for
the second -i option. Without -i "zip" all of the archives would
be excluded too!

7. grepfv @grep.opt myexp myfile.*

Reads the options from grep.opt and then adds the remaining
command line parameters. If you have a standard search that you
perform regularly then the whole command line can be held in a
file then the grepfv call is simply
grepfv @optionfilename


History
=======

Grepfv10 fixed the following:

-  Introduced the -o output file feature
-  Introduced the @file feature to read options from a file

Grepfv9 fixed the following:

-  Introduced -i include files option
-  -x and -i now take a wild card expression

Grepfv8 fixed the following:

-  Frees some stack for FV.COM
-  Introduced -x exclude option
-  Throws a line after failure reports
-  Indents found text by two characters for ease of reading
-  Prints a summary of activity at the end of processing
-  Avoids crashing with zips that contain files whose names
   begin with -
-  Prints options at the start of processing

Grepfv7 fixed the following:

-  Support for ARJ archives
-  New source supplied

Grepfv6 fixed the following:

-  Password protected archives cause a failure report but do not
   abort processing
-  Archives with stored subdirectories are handled correctly
-  New source included

Grepfv5 fixed the following :

-  Source code included for the first time
-  Stack size increased to avoid overflow
-  grepfv4 did not handle PKZip version 2.04 correctly
-  my email address was wrong in the docs (sorry)



---------
Copyright
---------

grepfv  may be distributed freely as long as this document
is left unchanged. Indeed I would be grateful if you would
distribute it to any sites where it is not available.

If you keep it you should register it by sending a donation of
not less than 10 UK pounds cash (in any currency) to me.

Nigel Salt
25 Lower Station Rd
Crayford
Kent
DA1 3PY
UK

Phone +44 322 553260

Internet nao@cix.compulink.co.uk


