[ < < < Home ] [ < < Reference Start ] [ < Reference Contents ]
[ < Previous=GREPPES Information ] [ Next=PDGREPPE 3.13 Introduction > ]

Intelligence Services

GREPPES Options

This section contains information about Options that are used
in the same way by GREPPES (FGREPPE and PDGREPPE).

They are listed by menus by giving a GREPPE a command line like

	FGREPPE -a

or

	PDGREPPE -a

The common menus to both GREPPES are

	File, View, Search, Replace, Misc and Help.

Some of the options are also used by another Text Tool called
NLX, the newline translation tool.  They affect backups and
non-standard file names are covered in COMMON Options.

Many GREPPES shared options are discussed further in this
section or COMMON Options.

For BEGINNERS some useful options are:

	-i	  letters in pattern are case Insensitive.
	-l	  show only one Line with file name if meets criteria.
	-q	  Quit each file on first match.
	-1	  process only 1 match per line.
	-B	  Blink in match to screen.
	-H	  High intensity in match to screen.
	-P<d>	  show up to <d> lines Previous to match line.
	-jc	  show match area in <Closure>.

as detailed below.

Also the section named Common Options has details about other
options that GREPPES use.

GREPPES Common Options ENVIRONMENT variable

To have both GREPPES in PentaTextTools use the SAME default options
listed in this section, see the section on Options about

	Common Options ENVIRONMENT variables

Simple steps for this are:

1)

Create a Batch File ENVIRONMENT variable such as

	GREPPES_OPTIONS

Place a line in a batch file like AUTOEXEC.BAT like

	set GREPPES_OPTIONS=-i -jt -jc -H -tD -kB -ki -kF

or in shorter form:

	set GREPPES_OPTIONS=-ijtjcHtDkBkikF

that contains the common options for BOTH Greppes.

Also added into this could be a custom PentaTextTools Common
variable like "TT_OPTIONS" as detailed in Options.  With
this the variable setting could become:

	set GREPPES_OPTIONS=%TT_OPTIONS% -ijtjcHtDkBkikF

2)

Then ADD it into a program's specific ENVIRONMENT variable with
another line such as:

	set PDGREPPE_OPTIONS=%GREPPES_OPTIONS% -jO -j@c:\pdgreppe

that creates the specific variable PDGREPPE uses to configure
its default operation.

Types of Options

GREPPES Options can be divided into various areas of use.

Also there are special rules that apply to options.

Options that Affect Patterns

Options are handled IN SEQUENCE on the command line.

And GREPPES have to "compile" or make a search or replace
pattern before it can be used.  Also GREPPES can be customised
by options to format output in certain ways.

Therefore:

Specify options that affect compilation or USE of a pattern
BEFORE the first data/file name on the command line.

Search patterns are specified, or re-specified by options:

-e<d>, and -jl<d>

Edit or Replace Patterns are specified by options:

-kr<d>, and -kl<d>

Option Descriptions

The following is a description of OPTIONS used in COMMON by both
FGREPPE and PDGREPPE.

OPTION:

-1	  process only 1 match per line.


After a pattern is matched within a window, the next search
takes place on the next line where there is no part of the
previously matched area.

For example: in FGREPPE with the pattern "apples" and a file
having 10 "apples" you will get 10 lines of matched data.  When
using the "-1" option and the file has 10 "apples" but only on 5
lines you will only get 5 lines of output.

If you are using PDGREPPE and getting lots of data, this is the
one to use.

For example, in PDGREPPE with the pattern "." (match any
character) and a file having 200 characters you will get 200
lines of matched data.  When using the "-1" option and the file
has 200 characters but only 20 lines you will only get 20 lines
of output.


	fgreppe -Hjc P file_id.diz


...lines with "P".


	fgreppe -Hjc -1 P file_id.diz


..."-1" ends search on each line after finding first "P" on
each line.

OPTION:

-A<d>	  show up to <d> lines After match line.


For looking at the context of a match related to next
lines.


	fgreppe -Hjc -n fixed file_id.diz


...lines with "fixed".


	fgreppe -Hjc -n -A2 fixed file_id.diz


..."-A2" show up to 2 lines After line with "fixed".

Like option -P<d>, only shows non-empty lines.  If used with
option -P, will give blank line before next possible previous
line.

Affected by options -tc<d> and -td.

See Option -P<d>.

OPTION:

-B	  Blink in match to screen.


Blink of matched areas on screen.

Displays matches in a dramatic way.  Try -H too.  Or -BH for
both.


	fgreppe P file_id.diz


...lines with "P".


	fgreppe -B P file_id.diz


..."-B" Blink matches.


	fgreppe -B -H P file_id.diz


..."-B" Blink and "-H" High-light matches

Zowie!

Please refrain from using this with option -H if You are
sensitive to flashing lights.

Also, common option -tb turns OFF any blinking by a Text Tool.

(Note: MS Windows often do not fully support blinking or
hi-intensity.  Try pressing the Alt-Enter key combination to
bring on a FULL semi-traditional DOS screen to see Blinking
under MS Windows.)

OPTION:

-C<d>	  pre-filter input data by Command <d> with sub [F].


Note:

This is an excellent option for use with TextTool NLX, that can
translate text files from/to UNIX and Apple Mac formats by
adjusting EndOfLine (NewLine) sequences.

For example a command of

	PDGREPPE -C"NLX -kekw" somePattern *.txt

will send each of the files

	*.txt

through the command

	NLX -kekw

that translates any non-DOS NewLines in each copy of a *.txt
file to DOS NewLines.  NLX then presents PDGREPPE with a DOS
text file that PDGREPPE can operate upon and search for the
pattern "somePattern".

(The original *.txt files are not affected unless PDGREPPE is
editing and using option -ko.)

See Common Options.

OPTION:

-G	  show data in match area Gap only.


Only the actual area of the data match will be shown as data,
rather than entire line(s) of data.


	pdgreppe -Hjc \d+ file_id.diz


...show entire line to include match Gap, on lines with decimal
numbers "\d+".


	pdgreppe -Hjc -G \d+ file_id.diz


..."-G" show data ONLY in match Gap.

OPTION:

-H	  High intensity in match to screen.


Like -B.

Works best in colour, or in monochrome with light letters on dark
background.

Matched areas will appear with alternate brightness on screen.


	fgreppe P file_id.diz


...P's not so evident.


	fgreppe -H P file_id.diz


..."-H" Hi-Lites P's.


	fgreppe -jc -H P file_id.diz


...my preference of "-H" with option "-jc"...

Again, like option -B, does not do full intensity under some
MS Windows implementations.

See Also Option -B.

OPTION:

-I	  show pattern Information.


Information is given relating to special character sequences.

Ends processing of further options/data.


	pdgreppe -I me_too me_2


..."-I" plenty pattern Info for exotic search tool PDGREPPE.


	fgreppe -I me_too me_2


..."-I" less pattern Info for simple search tool FGREPPE.

And NO further processing of parameters "me_too" and "me_2".

OPTION:

-P<d>	  show up to <d> lines Previous to match line.


For looking at the context of a match related to preceding
lines.


	fgreppe -Hjc PC file_id.diz


...lines with "PC".


	fgreppe -Hjc -P2 PC file_id.diz


..."-P2" show up to 2 lines Previous to lines with "PC".


	fgreppe -Hjc -P2 -A2 PC file_id.diz


..."-P2" and "-A2" show up to 2 lines Previous to
and After lines with "PC".

Affected by options -tc<d> and -td.

See Option -A<d>.

OPTION:

-Q	  Quit program on first match.


This is like option -q and ends entire program after a single match.

OPTION:

-S	  show Summary for group of files.


This occurs once at the end of using either FGREPPE or PDGREPPE.

It shows TOTAL numbers across ALL files GREPPED as totals of

	data sources,
	data sources that met criteria,
	lines searched,
	lines that met criteria,
	matches found,
	data sources changed if editing,
	changes made if editing.


	pdgreppe -lh -S ` .


..."-S" Big Summary after all other output.

OPTION:

-V        strict program return Value.


If a Greppe is searching for a match and finds one or more files
that match the search pattern (met the criteria), then the
program exit or ERRORLEVEL value will be ZERO (Success).

If a Greppe is searching for no match (option -v) and finds one
or more files that do NOT match the search pattern (do meet the
criteria), then the program exit or ERRORLEVEL value will be
ZERO (Success).

Option -V makes this more strict.

For a Greppe program exit or ERRORLEVEL value to be
ZERO (Success), each and every file must meet the criteria.

If searching for matches, and all files have at least
one match, then there is Success.

Or if searching for unmatched data, each and every file must NOT
contain any matches for there to be an ERRORLEVEL or exit value
of ZERO.

OPTION:

-b	  show file match Byte position with prefix FP.


Each time the criteria is met and there is data output the file
position will be given before any data output, eg "FP138".

The first file position is 0, the last file position is the
number of bytes in the file minus 1.


	pdgreppe -Hjc -b "`|'" file_id.diz


..."-b" shows match Byte File Position FP numbers.

("`|'" shows Start (`) OR (|) End (') of file_id.diz)

OPTION:

-d	  show output Data length with prefix DL.


Each time the criteria is met and there is data output or option
"-jd" is used, the length of file data will be given before any
data output, eg "DL24".


	fgreppe -Hjc -E -d \N file_id.diz


..."-d" shows Data Length DL numbers of DOS newlines (\N) and
data preceding newlines in file_id.diz.

OPTION:

-e<d>	  Exchange for different search pattern <d>.


The first non-option string, not starting with "-", in command
line is used as pattern by GREPPES.

A different search pattern than the first can be specified with
this option -e<d> where <d> represents the pattern.

Also, use this when the ENTIRE pattern is the - character
normally used to denote an option.

Use this to change from one pattern to another and not have a
pattern be confused with a data file name.


	fgreppe -Hjc TEXT -e MAGIC file_id.diz


..."-e MAGIC" changes pattern from "TEXT" to "MAGIC".

The string MAGIC becomes the search pattern, FGREPPE does not
search a file called MAGIC.

About a pattern of "-",


	fgreppe -Hjc -e- file_id.diz


...-e- CANCELS any search pattern and an error message is given.


	fgreppe -Hjc -e"-" file_id.diz


...-e"-" makes the search pattern be "-".

OPTION:

-f	  show File name at front of each line.


File name at start of each line of output.  Each line of data is
prefixed by the name of the file where the criteria was met, for
reference/sorting.  The file name also appears in the optional
small summary.


	pdgreppe -Hjc "^" -f file_id.diz


..."-f" shows File name file_id.diz before each line of output
found by magic pattern StartOfLines (^).

OPTION:

-g	  show match Gap length with prefix ML.


Each time the criteria is met and there is data output the width
of the match area will be given before any data output, eg

	ML24


	fgreppe -Hjc -g MAGIC file_id.diz


..."-g" match Gap gives Match Length "ML" numbers.  MAGIC has a
width of Five bytes so the prefix "ML5" is given.

OPTION:

-i	  letters in pattern are case Insensitive.


Search/comparison patterns will see the same letter in lower
case (small letters) and upper case (capitalised) as equal.


	fgreppe -Hjc magic file_id.diz


...regular search for "magic" all in lower case letters does NOT
find the string "magic" in file_id.diz.


	fgreppe -Hjc -i magic file_id.diz


..."-i" search for case INSENSITIVE "magic" found "MAGIC"
because lower and UPPER case letters compare the same...

This only works for the 26 letters in the standard English
character set of A to Z:

	ABCDEFGHIJKLMNOPQRSTUVWXYZ

OPTION:

-jE<d>	  <d> is string to show match End. (>)


The user can select the right match-end marking string for
option -jc with this.


	fgreppe -b -jc MAGIC file_id.diz


...default closure.


	fgreppe -b -jc -jE"<-EndOfMatch" MAGIC file_id.diz


...-jE"<-EndOfMatch" End custom closure.


	fgreppe -b -jc -jS"StartOfMatch->" -jE"<-EndOfMatch" MAGIC file_id.diz


...-jS"StartOfMatch->" and -jE"<-EndOfMatch" enclose with custom
End and Start strings.

OPTION:

-jF<d>	  take options and specs from File name <d>.


The best way to get long lines of pattern data into data streams
is to use the "-jl<d>" and "-kl<d>" literal-pattern-from-file
options in FGREPPE when using literal patterns and to use PDL
(Pattern Definition Language) equivalence files for PDGREPPE.

See Common Options.

OPTION:

-jR	  Rescan data continuously.


With this You can search for matches in a data source repeatedly.

This could be valuable in a network environment where a file is
to be examined in an endless loop.

It only happens if NOT editing (-ke) and possibly changing (-ko)
a file.

This is similar to options -jr and -kR but continuous.

Options -jr, -jR and -kR

Options -jr, -jR and -kR are processed in the sequence: -jR, -jr
and -kR.

To further complicate matters, system file-waiting with option
-jn can be used.

If one of these options grabs a file, the program releases the
file to the system at the end of each search.

There are probably some useful combinations of these that are
not documented yet.

Each scan of a file is counted as an additional data source in
the summary given by option -S.

To ESCAPE a rescan just hit a key when the screen is active and
the next possible data source will be searched.

See also options -jn, -jr and -kR.

OPTION:

-jS<d>	  <d> is string to show match Start. (<)


The user can select the left match-start marking string for
option -jc with this.


	fgreppe -b -jc -jS"Start_of_match->" "MAGIC" file_id.diz


...-jS"Start_of_match->" Start of match custom message string.

OPTION:

-jc	  show match area in <Closure>.


Surround the match area in a pair of Corner < and > characters.


	pdgreppe -1 -jc "<\W+>" file_id.diz


..."-jc" Closure around some matched areas that are words
"<\W+>".

OPTION:

-jd	  omit Data print.


Do not print any line data to output.

For example, to just show a list of match line numbers use
"-njd" (or "-n -jd") as options to show line numbers "-n" and no
data "-jd".


	fgreppe -Hjc -n x file_id.diz


...pattern "x" with all data in line(s) matched.


	fgreppe -n -jd x file_id.diz


..."-jd" Just line number(s) and NO Data in line(s) matched.


	fgreppe -n -d -jd x file_id.diz


..."-jd" and "-d" same but give amount of data (without line
number info "-n") that would have come out by option "-d".

OPTION:

-jf	  Filter output to Text characters.


Display any non-text character sequence as high-lighted '@'.

When this is done, to determine the difference between what is a
converted character '@' and what is a real character @ in a
match, use the -H or -B option: a real @ character in a screen
match area will respond to -H or -B.

See Common Options.

OPTION:

-jl<d>	  use entire contents of file <d> as Literal search data.


Use a file's contents as the search pattern.  NO interpretation
of any escape sequences "\<char>" is done on the file's
contents.  This can be good when searching for a binary or mixed
binary/ASCII sequence that could have any assortment of
characters for exactly just those characters, including ones
that are difficult to give on the command line that would
otherwise would be escaped with sequences like "\<char>".


	fgreppe -lHjc -jl"FILE_ID.DIZ" *.*


...-jl"FILE_ID.DIZ" finds file FILE_ID.DIZ because it contains
its own data that is used for the literal search pattern.

If the file is not found "as is" with the current path, another
attempt is made to find the file with the directory given by
option "-tF<d>".

OPTION:

-jr	  Rescan data until matches detected.


This is like -jR but will jump out after matches are detected.

See option -jR.

OPTION:

-jw<d>	  Word character range is [<d>]. ([0-9A-Za-z])


The pattern <d> gives the character(s) normally found in a word.

Pattern [A-Z] means all capital letters A, B, C through Z.

Pattern [a-z] means all lower case letters a, b, c through z.

Pattern [0-9] is numbers 0 through 9.

This option is a good way of expanding the Word character range
to include characters used by non-English languages.


	pdgreppe -1 -Hjc "<\W+>" file_id.diz


...some word sequences having [0-9A-Za-z] as valid components.


	pdgreppe -Hjc -jw0-9 "<\W+>" file_id.diz


..."-jw0-9" finds some Word sequences having just [0-9] (no
letters) as valid components.


	pdgreppe -Hjc -jw[0-9] "<\W+>" file_id.diz


..."-jw[0-9]" brackets "[" and "]" around range <d> data are
optional.

Also, a character can be specified with an Escape symbol of
BackSlash in front of its numeric equivalent.


	pdgreppe -Hjc -jw\48-\57 "<\W+>" file_id.diz


..."-jw\48-\57" works like "-jw0-9" in PDGREPPE.  (\48 is '0'
and \57 is '9').


	pdgreppe -Hjc -E -jw\65-\90 "PC" file_id.diz


..."-jw\65-\90" works like "-jwA-Z" in FGREPPE if option -E is
used to allow Escape sequences.  (\65 is 'A' and \90 is 'Z').

OPTION:

-kI	  Ignore case in matches when interactive edit.


When matching to a pattern that contains letters and Options -i
and -ki are in effect, matches can be different from each other,
such as a pattern of

	xyz

matching data like

	xyz, xyZ, xYz, xYZ, Xyz, XyZ, XYz or XYZ.

Normally these are each considered different for automatic
replace or skip-replace RDC's of [CI-=].

With Option -kI all of these are considered equal to the pattern
and automatic replacements or skip-replacements are made without
regard to upper or lower case letters.

OPTION:

-kR	  Rescan if edit original file, got matches and reduced result size.


With this You can rescan a file being edited but only if the
file is becoming smaller in size.

Also, only Rescans if matches are still being found.

See options -jr and -jR.

OPTION:

-ke	  Edit matches - Use this to switch ON editing.


Take the input and record a list of all file positions where
matches to the pattern are found.  Then after all searching of
the data source is done, make a replica of the original data
source with matched areas either removed, or with a Replace
pattern, the matched area is changed by substitution.

When giving summary information, numbers are given for total
number of replacements made, and if edit Original file, the
number of files changed.

Edit of matches has been made difficult deliberately:

A user should read documentation and heed warnings before ANY
editing.  Especially with the "-ko" option.  Like the boxing
ring "KO" can "KO" your files so BE CAREFUL.


	fgreppe -Hjc "by " file_id.diz


...strings "by " in file_id.diz.


	fgreppe "by " -ke -kwki file_id.diz


...edits (-ke) interactively (-ki) that can delete any strings
"by " in file_id.diz because Edit Default action is Delete (and
NO replacement pattern is given by option "-kr<d>").

Only files with date-time stamps previous or equal to
the current date-time are edited.

See Common Options.

OPTION:

-kf	  Force edit changes to file if write protected.


When editing an original file (option -ko), this lets the file
be modified even if the original file is READ ONLY.  If a file
has been affected this way by giving a DOS command like:

	"attrib +r <filename>"

then GREPPES will try and remove write protection, modify the
file and then set the write protection and any other attributes
back to their previous state after editing is done.

OPTION:

-ki	  Interactive edit mode.


When Edit matches, prompt for a simple command to perform with
each match found by a set of one character RDC's or

	Replacement Decision Commands

like this:

[Y<Enter> N<Space> C + I - A ! . D X E Q R U].

An explanation of the RDC's is given by entering ? for Help at
the Interactive edit prompt.

If a REPLACEMENT can be made the keys signify RDC's like:

Y or [Enter]	YES -   Replace this Match
N or [Space]	NO  -   Reject
C		Replace ALL of Same Match in this file
+		Replace ALL of Same Match in ALL  files !
I		Ignore  ALL of Same Match in this file
-		Ignore  ALL of Same Match in ALL  files !
A		Change  ALL Matches       in this file
!		Change  ALL Matches       in ALL  files !
.		Replace THIS Match - Exit this file - With Save
E		Exit this file - With Save - End Edit ALL files
X		eXit this file - With Save
D		Discard any changes and Restart file
Q		Quit this file - NO   Save
R		Redo from LAST Reject Prompt
U		Undo from LAST Change Prompt
Ctrl-C          Quit this file - NO   Save - End Edit - END PROGRAM
AUTO:
S               Show Automatic Local/Global Change and Ignore Matches
G		reset of Global [+-] Change and Ignore Data
L		reset of Local  [CI] Change and Ignore Data
INFO:
T               Toggle Verbose	on | off
W               toggle Warnings	on | off
V               View Match Again
O               Show Program Options
P               Show Search and Replace Patterns
F               Show Current File Name

If a DELETION can be made, "Replace" from above changes to Delete:

Y or [Enter]	YES -   Delete this Match
C		Delete  ALL of Same Match in this file
+		Delete  ALL of Same Match in ALL  files !
.		Delete  THIS Match - Exit this file - With Save

Quitting or Restarting Interactive Edit

If things get difficult, use Ctrl-C, Ctrl-Break or Q to quit
with NO changes, or D to restart the edit of the current file.

Replace/Delete Notification

When replacing via option "-kr<d>", interactive edit mode gives
Replacement Data between a pair of curly braces '{' and '}'
if there is a length to the replacement data.

Otherwise it gives a "Delete?" prompt.

Also a pair of corners like "<" and ">" surround the data
match, blinking and/or high lighted, in the inverse of whatever
options -H and -B are set to.  See options -jS<d> and -jE<d>
about different enclosure strings than  '<' and '>'.

Separating the Match and Replacement data is a line with
characters of

	^
	|
or
	?

symbols.

The "^" symbol appears when the length of data of both is an
exact corresponding amount.

The "|" symbol appears when the length of the Match data is
Zero.

The "?" symbol appears when the display contains tabs or spaces
that would not give an exact corresponding one-to-one match and
replacement width, or when the start of match data is not
visible on the current screen.

Around the replacement data are '>' and '<' characters to show
where the replacement data starts and ends.

These symbols make it easier to see where the lengths and
sequences of the matched and replacement sections are.

IF YOU ARE A BEGINNER TO GREPPES...
IF YOU ARE A CASUAL USER OF GREPPES...
IF YOU CARE ABOUT YOUR EDIT SESSION...	always USE THIS ONE.


	fgreppe -Hjc PC -kekr"MAGIC" -ki file_id.diz


..."-ki" Interactively substitutes MAGIC for PC in file_id.diz
if YOU WANT IT TO.

Match Varieties

If editing with magic (PDGREPPE), or a case insensitive pattern
(FGREPPE or PDGREPPE) via option -i, then RDC commands

	C, +, I and -

can take on special meaning since patterns like

	"more"

can match

	"More" or "MORE" or "more"

or other case insensitive permutations, and these are NOT all
the Same Match.

With the same conditions, if the current file is the only file
or last file in the file set, GLOBAL change/ignore RDC's

	+ and -

do NOT appear on the RDC menu yet can still be used.  (They are
usually applicable to more than one file.)

Automatic Change/Ignore RDC's

RDC Ignore commands

	I, -,

and Replace commands

	C, +, A and especially "!"

MUST BE ANSWERED WITH CARE.

These are AUTOMATIC commands.  They will automatically ignore or
replace further findings.

The most SEVERE of these are the

	+

and

	!

commands since they will change the current match and all other
previously established automatic replacements in ALL files in
the current file set WITHOUT further questions.

(Ctrl-C or Ctrl-Break can still be used to abort the program but
some changes might occur before it takes effect.)

If editing with a purely literal (NO Magic) pattern and case
sensitive (no use of option -i) then RDC's

	C, +, I and -

do not appear.

(However RDC's A, !, X and E are similar to these.)

If automatic change or ignore RDC's are given such as any of

	C,+,I,-	RDC's

then a RDC of 'S' appears as:

S               Show Automatic Local/Global Change and Ignore Matches

It will show what the current change/ignore match values are for
both local and global change/ignore RDC's.

If the available automatic change(s) or ignore(s) are LOCAL, that
is, to apply just to the current file and RDC's are given by

	C or I	RDC's

a RDC of 'L' appears as:

L               reset of Local  [CI] Change and Ignore Data

that RESETS the current local automatic changes or ignores on
the current file so they do not have effect on the current file.

If the available automatic change(s) or ignore(s) are GLOBAL, that
is, to apply to ALL files of the current data, and RDC's given by

	+ or -	RDC's

are used, the RDC 'G' appears as:

G               reset of Global [+-] Change and Ignore Data

that is similar to RDC 'L' but applies to all files (GLOBAL)
affected by the [+-] change/ignore RDC's and RESETS those
automatic change/ignore data pairs.

OPTION:

-kl<d>	  use entire contents of file <d> as Literal replace edit data.


Use a file's contents as the replacement data.  NO
interpretation of any escape sequences "\<char>" is done on the
file's contents.  This can be good when replacing with a binary
or mixed binary/ASCII sequence that could have any assortment of
characters with exactly just those characters, including ones
that are difficult to give on the command line that would
otherwise would be escaped with sequences like "\<char>".


	fgreppe "Intelligence Services," -kekw -kl zip_crc.lis FILE_ID.DIZ


...-kl"zip_crc.lis" inserts file ZIP_CRC.LIS in place of
the string

"Intelligence Services,"

in FILE_ID.DIZ.

If the file is not found "as is" with the current path, another
attempt is made to find the file with the directory given by
option "-tF<d>".

OPTION:

-ko	  modify Original file by edit.


When editing matches, and input data is a file, then modify the
original input file to be affected by the edit deletions and/or
substitutions.

If You are unsure about this, use the Backup edit original file
option "-kb", that gives you a copy of the original if something
goes amiss.  And use option -s to show what the Backup file name
is or observe the output and record the Backup file name.

The Original file must be on a disk that can be written, not on
a CD-ROM or disk that is write-protected.

Also, if filter of file by -C<d> option, the original file
is modified to be a copy of its filtered data put through the
edit process.

If using an advanced editor like EMACS that allows a portion of
its buffers to FILTER through an external command, then option
-ko ensures that only the changed portion's content flows back
into the buffer region.  (No summary or other data.)

The DOS command line operators of INPUT REDIRECT < and PIPE |
can also be used.  These are different from the ERE magic
symbols of < and | in PDGREPPE.


	fgreppe -Hjc PC -kekokr"MAGIC" < file_id.diz


DANGEROUS TERRITORY!

IF YOU ARE A BEGINNER TO GREPPES, USE THIS ONE ONLY AFTER
EXPERIMENTING WITHOUT "-ko".

IF YOU ARE A BEGINNER TO GREPPES...
IF YOU ARE A CASUAL USER OF GREPPES...
IF YOU CARE ABOUT YOUR EDIT SESSION...	ALSO USE -ki and -kv.


OPTION:

-kr<d>	  <d> is edit Replace pattern.


When editing matches, without a REPLACE pattern, the edit
function replaces the matched areas with NOTHING, it deletes any
match space.  With this option and a pattern <d>, each changed
area is replaced with data <d>.

Escape sequences can be used in replacement patterns.  To
include spaces in a replace pattern, be sure to surround the
entire pattern with double quotes "<pat>".


	fgreppe PC -kekwkr"MAGIC" file_id.diz


...-kr"MAGIC" Replaces MAGIC for PC in file_id.diz.

OPTION:

-kt	  if modify original file (-ko) keep previous Time and date.


If editing an original file (-ko) then any edited files will
have their time and date kept the same as before being changed.

OPTION:

-kv	  Verbose edit mode.


If Interactive edit, this option gives an extra line of diamonds
and file name for each match.

IF YOU ARE A BEGINNER TO GREPPES...
IF YOU ARE A CASUAL USER OF GREPPES...
IF YOU CARE ABOUT YOUR EDIT SESSION...

USE THIS AND INTERACTIVE (-ki) to edit SAFELY.

When in INTERACTIVE mode, the RDC of 'T' can be given to switch
or Toggle this to an opposite state.

If then in the verbose state, a line of diamonds and the current
file name are shown for each succeeding display of a match.  If
not then they are not shown for each display of a match.

See also options -ki, -kw.

OPTION:

-kw	  omit edit Warnings.


For safety of data, especially to users of GREPPES for the first
time, a number of simple warnings are given for conditions that
would cause loss or changes of data by mistake.

This option KILLS these safety features.

IF YOU ARE A BEGINNER TO GREPPES...
IF YOU ARE A CASUAL USER OF GREPPES...
IF YOU CARE ABOUT YOUR EDIT SESSION...	NEVER use this one.

When in INTERACTIVE mode, the RDC of 'W' can be given to switch
or toggle this to ON so that warnings like secondary prompts are
available if option -kw has not yet been given.

OPTION:

-l	  show only one Line with file name if meets criteria.


Abbreviate search to just show file name if met criteria,
nothing else, unless summaries are specified.

Options like "-b", "-d", "-g", "-m", "-n", "-p" have no effect
if this is used.


	pdgreppe -Hjc -l ` .


..."-l" just List file names of all files in current directory
"." by pattern "`" that symbolises a Start of File by PDGREPPE's
pattern matching language.

OPTION:

-m	  show Match number with prefix MN.


Display the number of each match with the prefix MN, eg "MN3".


	fgreppe -Hjc -m P file_id.diz


..."-m" Match Number "MN" info given for each "P" found.

OPTION:

-n	  show line Number.


Number lines with first line being line 1.  This will number
lines with a decimal number.


	pdgreppe -Hjc -n "^" file_id.diz


..."-n" shows un-prefixed line Numbers at matches to
Start_Of_Lines pattern symbol "^".

Line numbers come first on output lines with other number data
options like -d and -p coming next.

OPTION:

-p	  show line match Position with prefix LP.


Each time the criteria is met and there is data output, the line
position where the match starts will be given before any data
output, eg "LP15".

The first line position is "LP0".

Line or match position also means Character position.


	fgreppe -Hjc -td -p P file_id.diz


..."-p" Line Position "LP" numbers shows zero-based Position of
first match characters for any "P" in file_id.diz.

(Option -td shows spaces and tabs as Dots and Diamonds and each
byte of either counts as one position.)

OPTION:

-q	  Quit each file on first match.


The test for any further matches in current file or other files
given by the current data specification is ended after the first
match is located.

This allows a program to stop finding items if a single item is
found.  It permits the programs to return exit values to the
calling process with no further testing of any files.  This can
be used in batch files that rely on just the exit value for a
single match.  Further processing of other possible data
specifications given in the command line continues.

EXE files in Root directory or below:


	pdgreppe -lh -r ` \*.exe


...NO quit on first find.

Now, same as previous example but just first file:


	pdgreppe -lh -r -q ` \*.exe


..."-q" Quit on first find.

OPTION:

-r	  Recursive search for file(s), dir\files(s) or dir\.


Greppes quickly search a file system for data.

For example

	FGREPPE -hH -r quick c:\

will search the C drive for ALL files containing the string
"quick" and Hi-Lite "-H" any matched areas.

	FGREPPE -l -h -r mystery c:\story.*

will search the C drive for ALL files called "story.*"
containing the string "mystery".

	FGREPPE -l -h -r legend c:\epic

will search the C drive for ALL files called "epic" containing
the string "legend".  If no plain files named "epic" are found,
then if a directory "c:\epic" exists, FG will search directory
"c:\epic" for ALL files containing the string "legend".

	FGREPPE -l -h -r legend c:\epic\

will search DIRECTORY "c:\epic\" for ALL files containing the
string "legend".

If you have files in "\" Root Directory


	pdgreppe -lh ` \


...locates all files in "\" Root directory.

If you have files in "\" Root Directory and BELOW


	pdgreppe -lh -r ` \


..."-r" Recursive search for all files in "\" directory and
below.

If you have EXE files in the "\" Root Directory and BELOW...


	pdgreppe -lh -r ` \*.exe


...does a "-r" Recursive search for all "EXE" files in topmost
"\" directory and below.

(These may take a while...)

OPTION:

-s	  show Summary of Pattern, File and Results per file.


This occurs once for each file searched that meets some amount
of criteria.  (The file searched has matches OR the option for
searching for unmatched areas (-v) was used and there were
complete lines without matches.)

Shows numbers for

	matches found,
and
	changes made if editing.

It also shows

	the name of the File in DOS 8.3 format including the path,
	the name of the File in DOS IFS format if available,
	the Search Pattern(s),
	the Edit Replace Pattern(s) if editing,
	the Edit Backup File if editing original file with backup,
	and the options in effect.

(Not so small but better than no summary).


	pdgreppe -s -1 -Hjc "<\W+>" file_id.diz


..."-s" Summary info comes at end of output.

The number of matches in this example was the number of Words
matched by the pattern for Words "<\W+>".

OPTION:

-tB	  use minimum length for search Buffer.


Each GREPPE uses a RAM buffer to store intermediate data from
files.  This option is used for test purposes and may result in
slower searches.

OPTION:

-tD	  show screen match/replace space or tab as Dot or diamond.


This is similar to option "-td" but only affects the match area
display to screen when searching and the replace area display
when replacing by interactive edit.

See Common Options.

OPTION:

-ts	  show technical Summary.


This occurs once for each file searched.

Shows numbers for

	lines searched,
	lines that met criteria,
	length of file,
	date and time of file,
	if edit original file, the length of modified file,
	if edit original file, the date and time of the modified file,
	the length in bytes of the entire search buffer

and

	the length in bytes of the re-search area of the buffer.

This summary contains items that would be part of comprehensive
search information.

It is meant to be used with the small summary option (-s).

The length of the re-search area is always less than the entire
search buffer.  It is recycled at least once, if there is extra
data beyond it, to ensure that all data is searched.

OPTION:

-v	  inVert search to lines missing pattern.


Vary search criteria to unmatched.

Only show lines that do not have matches to pattern.

This will show one line at a time of all lines that do not
contain any of the search pattern, and thus satisfy the
unmatched criteria.

Options like -B, -H, -b, -g and -p have no effect when this
option is used.


	fgreppe -Hjc -bgp PC file_id.diz


...lines with "PC".


	fgreppe -bgp -v PC file_id.diz


..."-v" Vary search to lines WITHOUT "PC"

[ < < < Home ] [ < < Reference Start ] [ < Reference Contents ]
[ < Previous=GREPPES Information ] [ Next=PDGREPPE 3.13 Introduction > ]

Intelligence Services

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