Dec 182017
 
C source for string searches in a file. Uses the Boyer-Moore method.
File FASTGREP.ZIP from The Programmer’s Corner in
Category C Source Code
C source for string searches in a file. Uses the Boyer-Moore method.
File Name File Size Zip Size Zip Type
BM.C 6371 1737 deflated
BM.H 517 285 deflated
EXECUTE.C 3019 949 deflated
EXTERN.H 760 307 deflated
GETPATFI.C 1652 572 deflated
GLOBAL.C 769 315 deflated
GREP.COM 12620 8111 deflated
GREP.DOC 2166 903 deflated
GREP.PRJ 253 121 deflated
LINKLIST 168 118 deflated
MAKEDESC.C 801 317 deflated
MAKEFILE 686 353 deflated
MAKESKIP.C 1602 603 deflated
MATCHFOU.C 1554 559 deflated
MKDESCVE.C 777 342 deflated
MOVERESI.C 1387 515 deflated
PRINTLIN.C 1001 357 deflated
PUTUSAGE.C 1096 443 deflated
SEARCH.C 1630 549 deflated

Download File FASTGREP.ZIP Here

Contents of the GREP.DOC file





GREP



NAME
grep - search a file for a pattern

SYNOPSIS
grep [ options ] expression [ files ]

DESCRIPTION
Commands of the grep family search the input files (standard
input default) for lines matching a pattern. Normally, each
line found is copied to the standard output. The following
options are recognized:

-x (Exact) only lines matched in their entirety are
printed.
-c Only a count of matching lines is printed.
-m Do not ignore upper/lower case distinction during
comparisons (default is ignore case).
-l Only the names of files with matching lines are listed
(once).
-n Each line is preceded by its relative byte number in
the file.
-s The error messages produced for nonexistent or
unreadable files are suppressed.
-e expression

Same as a simple expression argument, but useful when
the expression begins with a "-".
-f file
The strings list is taken from the file.
-h
Printing of the file names is suppressed.

In all cases, the file name is output if there is more than
one input file. It is safest to enclose the entire
expression argument in double quotes "...".

You may include more than one file specification on the
command line. For example

grep -m test *.c *.h

This will search all files in the default directory of the
form *.c and *.h for all occurrences of the word "test".

DIAGNOSTICS
Exit status is 0 if any matches are found, 1 if none, 2 for
syntax errors or inaccessible files (even if matches were
found).

BUGS
Ideally grep would print the line number in which the string
was found. Because the Boyer-Moore algorithm (which uses a
skip pattern) is used this is not possible.


 December 18, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)