FINDGREP(1) V1.0 FINDGREP(1)
19 NOV 1999
NAME
findgrep -findgrep [-lnisefcpdtBhaFSx] <reg.exp.> [<file name
reg.exp.>]
SYNOPSIS
findgrep
DESCRIPTION
Findgrep is a utility to recursively grep in the current directory and
subdirectories. It uses regular expressions to specify the search
expression as well as the file name. It now has support for
approximate matches. It is written in perl and runs on Unix and DOS
systems (I haven't received any information about Macs, but it should
run OK on these too).
OPTIONS
Options:
-l : list file names
-n : line numbers
-i : case insensitive
-s : shorten long lines
-e : treat file name reg.exp. as an extension
-f : use directory names in file name reg.exp.
and convert . to . and * to .*
-b : only search base directory
-p : write path name with the file names
-d : match file name reg.exp. on path name and
file name (concatenated)
-t : transform file names to lower case
-B : don't search binary files
-h : help screen
-a : approximate search
-F : use pattern file
-S : show paragraph
-x : exclude file/directory pattern
Options can be specified in the environmental variable FINDGREP just
like on the command line. Options given in the FINDGREP variable will
be overridden by the options given on the commandline.
An option can be turned off on the command line bu specifying '--no'
before the option letter. E.g. if you have specified 'FINDGREP=-n' the
numbering can be turned of on the command line using '--non'.
The options have the same effect whether specified on the command line
except for the approximate match modifiers. See approximate match for
a specification.
- 1 - Formatted: November 21, 2025
FINDGREP(1) V1.0 FINDGREP(1)
19 NOV 1999
On DOS systems the following definition in autoexec.bat is often
useful set FINDGREP=-t
DESCRIPTION OF OPTIONS
-l : list file names
List only the filenames of the files that have lines that match the
criteria. If used in combination with the -n option the lines numbers
of the first matching line is shown.
-n : line numbers
Show line numbers of matching lines.
-i : case insensitive
Do a case insensitive search. This makes the regular expresions case
insensitive for both the search pattern and the path and file name
pattern.
-s : shorten long lines
Show only a few lines of text around the place where some matching
text is found. This feature is useful when searching binary files that
do not have "standard" end of line chracters.
-e : treat file name reg.exp. as an extension Use the file name
specification as an extension (suffix) instead of a regular
expression. That means that "cpp" will be tranferred into ".cpp$". You
may specify more than one extension by using "(h|cpp)", which will
search files that have either "h" or "cpp" as extension. When used
with the -f option the last part of the file name specification will
be used as the extension.
-f : use directory names in file name reg.exp.
and convert . to . and * to .*
Make it possible to specify the base directory for the recursive
search. The remeaning part of the file name specification will have
the characters "." and "*" translated into "." and ".*" respectively
and in that order. This makes it easier to specify file names in a
used.
-b : only search base directory
- 2 - Formatted: November 21, 2025
FINDGREP(1) V1.0 FINDGREP(1)
19 NOV 1999
Only search the base directory. This makes findgrep work almost as
grep.
-p : write path name with the file names instead of
in seperate lines
The normal output of findgrep is to first specify the directory where
the search is made and then to write the file names without directory
names. The -p option changes this so the directory names are written
with the files.
-d : match file name reg.exp. on path name and
file name (concatenated)
Instead of just matching the file name the file name reg.exp. must
match the path name and the file name when they are concatenated
-t : transform file names to lower case
File names and path names are transformed to lower case before using
in tests and when printing. The case is preserved when opening files.
Useful on file systems that do not distinguish between (but allow)
upper and lower case (like Windows 96/NT).
-B : don't search binary files
Don't search files that appear to be binary.
-h : help screen
Print a help screen with the most commonly used options.
-a : approximate search
Search for approximate match. This is good for searching for
misspelled
information and when you don't know the precise spelling of words.
Warning: the approximate search takes much longer time than the
normal
search. Note that String::Approx must be installed for this to work.
--adiff, --ains, --adel --asub
Approximate is defined here as k-differences. One difference is an
insertion, a deletion, or a substitution of one character. The k in
the k-differences is the maximum number of differences. The default is
- 3 - Formatted: November 21, 2025
FINDGREP(1) V1.0 FINDGREP(1)
19 NOV 1999
to allow for one difference. This can be changed using the modifiers
above.
Approximate matching will automatically be used when any of the
modifiers are specified on the command line. This means that the -a
option can be left out. If the modifiers are specified in the FINDGREP
environmental variable the approximate match is not used unless the -a
option is specified. This feature allow one to specify defaults of the
modifers.
-F : use pattern file
Use the pattern in the specified pattern file for searches. A regular
expression cannot be specified on the command line if this option is
used. The pattern in the pattern file are separated by newlines.
Example The file 'pattern.ptn' contains: red blue green
Use findgrep to find these words in text files:
findgrep -e -Fpattern.ptn txt
-S : show paragraph
The standard output of findgrep is a single line where the matching
text if found. This is out of context with the rest of the text/file.
By using the option -S the entire paragraph where the matching text is
found will be displayed. findgrep uses an empty line to determine
where paragraphs start and end. Note that this option can create a lot
of output if paragraphs are long. This option can be combined with the
-s option. If used in combination with the -n parameter the line
number of the first matching line is shown with the file name (note
that there can be more than more match in a paragraph); the line
number of the lines in the paragraph will be shown as well.
When the -S option is used the number of lines in a paragraph is
limited to a default of 100 lines. This number can be changed using
the option
-S=<number>
-x : exclude file/directory pattern
Use this option to exclude files and/or directories that is otherwise
included. File names and directories must first positively match their
respectively specified patterns before this pattern is checked.
MORE INFORMATION
For more information see "http://www.gbar.dtu.dk/~matlg/findgrep/"
- 4 - Formatted: November 21, 2025
FINDGREP(1) V1.0 FINDGREP(1)
19 NOV 1999
PROGRAM AUTHOR
Lars Gregersen (lg@kt.dtu.dk)
MAN PAGE
Mehdi Lavasani <lavasani@csc.liv.ac.uk>
- 5 - Formatted: November 21, 2025