[ < < < Home ] [ < < Reference Start ] [ < Reference Contents ]
[ < Previous=Common Options ] [ Next=GREPPES Options > ]

Intelligence Services

GREPPES Information

GREPPES means PDGREPPE and FGREPPE.

To "greppe" something means to "grip" something in some Northern
European languages.

GREPPES are based on GREPS.

According to DEC and UNIX ideology, GREP is an abbreviation for:

	Get Regular Expression Print

or

	Global Regular Expression Print

or

	Global Regular Expression Parser

GREP's have traditionally been used for searching for data from
files or data streams on many different types of computers and
operating systems.

For PDGREPPE and FGREPPE:

	'F' of FGREPPE means Fixed pattern or Fast.

	'PD' of PDGREPPE is Pattern Definition or Public Domain.

and the

	'PE' of a GREPPE denotes Pattern Editor.

PDGREPPE can be used to search for data in a powerful
mathematical way.

FGREPPE searches for data in a simple yet FASTER way.

Example:

The PC DOS "FIND" utility will search a single file for a given
string.


	find "Search" file_id.diz


Notice that "FIND" can show some lines with the word "Search" in
file_id.diz.  It did not put any special emphasis on the text
found.


	fgreppe -Hjc "Search" file_id.diz


FGREPPE can do a much better job to find the "Search" string
with the areas high-lighted and put in corners by two options
"-H" and "-jc" in file_id.diz.

Another Example:


	find /i "s" file_id.diz


"FIND" can show some lines with the letter "s" or "S" in
file_id.diz.  It did not put any special emphasis on the text
found and does not give any indication of the total number of
"s" letters in the file.


	fgreppe -Hjc -i "s" -s file_id.diz


FGREPPE finds ALL the "s" letters, along with a summary to show
the total number of matches and other information about the
search through FILE_ID.DIZ.

The DOS "FIND" utility gives You a few options:


	find /?


Find gives just a FEW options.

However:


	fgreppe -a



	pdgreppe -a


FGREPPE and PDGREPPE give You plenty options to get any Search
and Replace job done right.

Computer programmers need powerful SAR (Search and Replace)
mechanisms to search and possibly change items of text in
more than one file, in more than one directory, in one shot.

GREPPES can do this!

Ideally, the GREPPES in edit mode would be used for changing
smaller amounts of text in any number of files, but if space
permits, they can do the same to much larger amounts of
search-replace data and large numbers of changes.

PDGREPPE and FGREPPE are Search and Replace editors.

They resemble Grep, Egrep, Fgrep and Sed on UNIX systems.

(Grep, Egrep and Fgrep are used to SEARCH for data.  Sed is the
efficient and fast UNIX "Stream EDitor" used to change or
REPLACE segments of data.)

PDGREPPE and FGREPPE incorporate some of the BEST features of
these UNIX tools, along with some custom ones, like PDL or
Pattern Definition Language and file system recursion, into the
PC DOS environment.

GREPPES enable PC DOS users, especially programmers, to have
access to more sophisticated tools than those provided by
standard PC DOS and "WINDOWS" programs.

Especially, they are good for changing variable names or other
text items in multiple files in multiple directories.

For example, an "old" style variable name of

	oldclass

can be easily changed in many files in many directories to

	BetterClass

by a command line like

	FGREPPE -r oldclass -kekikvkr"BetterClass" .

or

	PDGREPPE -r -F".*\.[ch]" oldclass -kekikvkr"BetterClass" .

These

1)

search for all files in a recursive manner (-r)

2)

edit (-ke) interactively (-ki) in verbose mode (-kv) with a
replacement value (-kr) of "BetterName"

3)

starting in the current directory (.)

And in PDGREPPE, only files that end in ".c" or ".h" are
searched, since

	-F".*\.[ch]"

specifies a magic or "Regular Expression" pattern that selects
only file names having "c" or "h" extensions.

GREPPES can also:

Search for data in any kind of file. (Binary or Textual).

Show matched area as HIGH-INTENSITY (-H) or BLINK (-B) to
screen.

Show file position, match length, line and line position of
matched data (-b, -g, -n and -p).

Show total length of data output for each match (-d).

Show ONLY matched area rather than matched area and data at
match ends (-G).

Search for lengthy expressions of pattern or in many specific
files via an OPTION/DATA Specification File.  The contents of
the file are parsed for options and data specifications
(-jF<d>).

Search for letter characters regardless of upper/lower case
(-i).

Briefly give indication of data match or no-match by just
Listing file name (-l).

End search on first match (-q).

Search for data on entire file system by recursive descent (-r).

Summarise a search, fully for many data sources (-S), or briefly
for each individual data source (-s).

Invert the search to show only data that do not contain any
matches (-v).

Search for data ONLY in pure ASCII or text files (-ja and -jt).

Display match information without showing match data (-jd).

Display data with NO control characters or unprintable, noise
characters (-jf).

Select the result of a search ONLY if it represents a word (-w
in Fgreppe, and "<" and ">" pattern characters in Pdgreppe).

Search for special characters by numeric codes after a pattern
escape character '\'.

RESCAN data, continuously (-jR), until matches are found (-jr)
and with edit, until all matches are changed (-kR).

PDGREPPE and FGREPPE can also search:

	Lines of any length

	Data with ASCII 0 characters

	In a network environment

	Up to and beyond the end of a line

	Once per line or more than once per line

	In a compact memory efficient way.

Other Detailed Information about GREPPES

Two of the most important functions to be performed on a
computer are those of Searching and Changing data.

GREPPES (FGREPPE and PDGREPPE) do these in an Expert yet simple
manner.

Shorter Names

Since the names FGREPPE and PDGREPPE are rather long, it is easy
to rename them to something shorter.  Perhaps give the DOS
command

	ren FGREPPE.EXE SE.*

to rename FGREPPE to be SE (Search Edit) and

	ren PDGREPPE.EXE SSE.*

to rename PDGREPPE to be SSE (Special Search Edit).

In these two instances, if using ENVIRONMENT options
FGREPPE_OPTIONS and PDGREPPE_OPTIONS, reissue them to be
different via the DOS commands like this:

	set SE_OPTIONS=<whatever FGREPPE_OPTIONS was>

or in a batch file reuse the FGREPPE_OPTIONS with the line

	set SE_OPTIONS=%FGREPPE_OPTIONS%

and for PDGREPPE,

	set SSE_OPTIONS=<whatever PDGREPPE_OPTIONS was>.

or in a batch file reuse the PDGREPPE_OPTIONS with

	set SSE_OPTIONS=%PDGREPPE_OPTIONS%

Or learn to use "doskey" available with MS DOS version 5.0+, or
other command line reuse tools, that make working with long
command names easy.

Exit Value

When checking the command exit ERRORLEVEL value in DOS, in the
case of regular searching:

Any match in any file will let it be 0 (SUCCESS),

BUT:

With unmatched searching using option -v, the ERRORLEVEL will be
kept at 0 (SUCCESS) only if the file(s) did NOT have a match.

ERRORLEVEL will be set to 1 if criteria are NOT met or no files
were available for searching and everything else was alright.

ERRORLEVEL will be set to 2 in case of a program error or
non-normal program operation, such as giving a faulty option or
bad pattern.

An ERRORLEVEL of 3 is given if something has gone really bad.
There may be temporary files to clean up in this case.

This table lists the values and descriptions:

GREPPE ERRORLEVEL Return Value

Value	Description

0	Success. Checking for matched data and at least 1 match.
0	Success. Checking for unmatched data and NO matches.
1	Searching for matches and data had NO match.
1	Checking for unmatched and data had one or more matches.
2	Program given bad pattern, options or data.
3	Program failure.  (Please contact by EMAIL: intlsvs@gmail.com)

Match Window

This is the area or space where a match to a pattern occurs.

By default many searches can occur per line or window of data.

Lines, or areas with repetitions of the pattern match will be
scanned multiple times until all matches have been found.  This
helps determine the TOTAL number of matches in a file.

At the end of a match, the next valid area for searching is
AFTER the previous match end.

Use option -1 to only identify one match per line of data.

Editing

PDGREPPE and FGREPPE can EDIT, Interactively or "On the Fly" in
a faster but less safe automatic mode.

They edit match data, either as data itself or a file containing
the data.  This acts as a simple Search and Replace mechanism
that makes changes to data or files easily, via match detection
capabilities.

Changing files via the edit feature is suited mostly for
changing pure text or pure ASCII files.

However, it will change binary files too, or any other file that
can be written.

There is NO GUARANTEE that a file with changes is usable after
being changed : many word processor files rely on certain key
control characters and formats, that once changed, will render
them unusable by WP applications.

Good Advice:

When editing safely do a dummy INTERACTIVE (option "-ki") edit
first.  (Do NOT use option "-ko".)  The program will display and
prompt for changes to be made.  Then if this seems to do the job
right, do an interactive edit ("-ki") with option "-ko" for
modify Original file and option "-kb" for Backup.

Editing with the GREPPES can be very sharp, like a surgeon's
knife.  So be super careful!

IF SPACE PERMITS, USE THE EDIT OPTION "-kb" THAT CAUSES THE
ORIGINAL FILES TO BECOME THE BACKUP FILES.

In the event editing should not have been done, the files in
their original form MIGHT still be on the disk.  Try using an
unerase or undelete type utility to recover them as a LAST
RESORT.

(MS Windows NT does not allow recovery of files deleted by
MSDOS.)

Search Patterns

There are two types of search patterns (SPAT's), Literal and
Interpreted.

Literal SPAT's contain exactly those characters that should be
searched for.  NO interpretation is done on the sequences of
search data.

For example, in FGREPPE the Literal SPAT "\97" will search
exactly for a backslash character "\" followed by a "9" then a
"7", rather than ASCII 97.

Interpreted SPAT's or Magic SPAT's contain characters that are
translated to mean something other than themselves:

In FGREPPE with option -E, or PDGREPPE in its default magic
mode, the SPAT "\97" will search for the character "a", the
equivalent of ASCII 97 because it will notice the backslash
character "\", go into interpretation mode and get the number
"97" as a single character "a".

In PDGREPPE, simple MAGIC SPAT's can have many varieties:

The sequence "..." could mean "abc" or "123" or any 3 characters
in sequence because the SPAT "..." has a Magic or Interpreted
symbolic meaning, interpreted as ANY three consecutive
characters.

(Each magic symbol "." is interpreted to mean ANY character.)

Including Special Characters in Patterns

Special Characters are ones like

	Spaces, Tabs or any of ", >, %, |, etc.

Quoted strings like "<param>" can enclose any
Command Line parameter or part of a parameter and
do not become part of the final value.

To include a space or tab as a part of a parameter,
use Quotes around an area, e.g.

	"space me"

becomes a single parameter

	space me

Without them, the area

	space me

becomes 2 parameters :

	space

AND

	me

To have a Quote be part of a parameter, use TWO of the
opposite type of Quote around the Quote, e.g.  the area

	"abc'"'def"

becomes the single parameter

	abc"def

or the area

	"spaces "'"'" here"

becomes the single parameter

	spaces " here

Combinations of Quotes and trailing or leading non-quoted
parameters, become a single parameter, e.g.

	this" and this "end

becomes the single parameter

	this and this end

Comparison of GREPPES to standard GREP:

Various tests have been made between either of the GREPPES
and

	Borland GREP.COM

that was part of its C/C++ and Pascal/Delphi development
systems.

GREP.COM (Borland GREP) is marginally FASTER than either of
the GREPPES when searching for simple case sensitive data
by 10% to 20%.

However, when searching for case insensitive data, either
of the GREPPES can be up to 5 TIMES FASTER than GREP.COM.

GREP.COM remains a premium tool for data location.

It is, or was, very small in size.

However, GREP.COM does not edit data matches.  Also, GREP.COM
does not highlight or blink areas matched to the VDU screen like
GREPPES can.  GREP.COM has a habit of konking out of a search if
a text line length exceeds about 64KB.  GREP.COM probably does
not use a window to search for data beyond its initial 50KB-60KB
search area.  This means that data could occur and not be found
by GREP.COM if it lies across the end of the initial search area
into the next possible data area retrieved from a file.

Downsides to GREPPES:

GREPPES do not fully handle long file names like those in
Windows 95 and NT.  (GREPPES are made to operate on almost ANY
IBM PC, not just those with MS Windows.)

Edit or Replace that changes these via options "-ke" and "-ko"
can be still done safely, by using option

	-kF       edit all Files as having long file names.

This option is detailed in the section on Common Options and can
be used to preserve long file names.

It is slower than using traditional MS-DOS 8.3 file names.

Also, regarding backup options "-kb" and "-kB":

Any back-up files for files have the extension ".BAK" or numeric
".000", ".001", ".002"...  either replaced for DOS 8.3 files,
or appended, for IFS or Long File Name files.

Also GREPPES are built around the standard IBM-PC ASCII
character set used for the English language, although various
options have been added to allow international use.


Upsides to GREPPES:

Both FGREPPE and PDGREPPE employ a special compiled search
pattern that is FASTER than most other search tools like the
very fast BORLAND GREP:  If GREPPES are used in the case
insensitive search mode with option "-i", they can be several
times FASTER than BORLAND GREP or any other GREP in the same
type search.

There are plenty useful UP's with GREPPES.

Fast, customisable, editable and exact are just a few.

See the OPTIONS SECTIONS for detailed information about GREPPES'
OPTIONS.

[ < < < Home ] [ < < Reference Start ] [ < Reference Contents ]
[ < Previous=Common Options ] [ Next=GREPPES Options > ]

Intelligence Services

© Intelligence Services 1987 - 2008   GPO Box 9,   ADELAIDE SA 5001,   AUSTRALIA
EMAIL   :   intlsvs@gmail.com