Make your own free website on Tripod.com

[ < < < Home ] [ < < Reference Start ] [ < Reference Contents ]
[ < Previous=Examples ] [ Next=NLX,Strings or Head Examples > ]

Intelligence Services

GREPPES Examples

The following are examples of Text Tools PDGREPPE or FGREPPE of
Penta Text Tools or Greppes Text Tools.

Each command line is described:

	FGREPPE -i "strange" -l -r *:\

will have FGREPPE do a case Insensitive (-i) search for strings
like strange or Strange or STRANGE and report or List (-l) just
the names of the files found with Recursive exploration (-r) in
all files on all drives (*:\).  Words like "estrange" or
"strangely" would also have their "strange" substring detected.

	PDGREPPE -i "cia|<kgb>" -l -r *:\

will have PDGREPPE do a case Insensitive (-i) search for strings
like cia,ciA,cIa,cIA,Cia,CiA,CIa or CIA or similar complete
words like kgb or KGB and List (-l) just the names of the files
found and do so Recursively (-r) in all files on all drives
(*:\).

The following are EDIT examples that could actually change file
contents.

	FGREPPE -w "IBM" -ke -ki -ko -kr"ibm" -kb *.txt

will have FGREPPE do a search for the Word (-w) IBM, turn on
Edit (-ke) in Interactive mode (-ki) with replacement of the
Original file (-ko) and interactively Replace these words to
become the string "ibm" (-kr"ibm") and leave backups (-kb) for
all files having a TXT extension in the current directory
(*.txt).

	FGREPPE -w "IBM" -kekikokbkr"ibm" *.txt

will do the same as the previous example but shows how options
that do not contain data (-kekikokb) can be stacked before an
option that does contain data (-kr"ibm").

	FGREPPE -w -i "microsoft" -kbkekikokr"MicroMess" *.txt

will have FGREPPE do a case Insensitive (-i) search for Words
(-w) like microsoft or MicroSoft or MICROSOFT or similar, turn
on Edit (-ke) in Interactive mode (-ki) with replacement of the
Original file (-ko) and You could Replace these words to become
the string "MicroMess" (-kr"MicroMess") and leave backups (-kb)
for all files having a TXT extension in the current directory
(*.txt).

	FGREPPE "microsoft" -iwkekikokbkr"MicroMess" *.txt

does the same and again shows how options can be stacked into a
single string (-iwkekikokbkr"MicroMess") to include the two
first non-edit options -w and -i.

Notice how in these examples, the options and patterns always
precede the file names, eg *.txt.

PDGREPPE and TXT2HTM : Text -> To -> HTML Converter

A sample use for a GREPPE is to convert a simple text file
without format for fonts, titles and tables into a file that is
better to look at.

Files TXT2HTM.* and BODY*.TXT are included in PentaTextTools.

They give a practical example of PDGREPPE and Pattern
Definitions in action.

TXT2HTM converts a text file to a HTML (Hyper Text Markup
Language) file that contains formatting and other information
tags.

These embedded tags help a World Wide Web reader or browser to
display items in a more readable font with variable sizes.

TXT2HTM consists of three Main Files:

TXT2HTM.BAT	This is used as a batch file with a single file parameter
TXT2HTM.ARG	This extends PDGREPPE's command parameters via option "-jF<d>"
TXT2HTM.DEF	This contains Pattern Definitions used for Search and Replace.

The Input for the example to TXT2HTM is FRUITS.TXT.

The contents of FRUITS.TXT is seen by executing this:


	pdgreppe "^" fruits.txt


FRUITS.TXT has various different areas: a title, a quote, some
prose, a table and descriptive paragraphs.

TXT2HTM converts FRUITS.TXT to TXT2HTM.HTM by using PDGREPPE and
interactive editing.  To make the edit just answer "A" for
"change ALL" and then "Y"  or "Enter" to complete changes with
this simple line:


	txt2htm fruits


The contents of TXT2HTM.HTM can then be seen with:


	pdgreppe "^" TXT2HTM.HTM


FRUITS.TXT has been converted to become TXT2HTM.HTM.

It has HTML Tags that surround different areas:

the Title, Quotes, Prose, Table and paragraphs.

So, it is easy as 1,2,3 with PDGREPPE to format this and other
similar text files while individual editing actions would have
taken much longer.

If a HTML Browser such as NETSCAPE or InterNetExplorer is used
to examine TXT2HTM.HTM, it can be seen that various HTML TAGS
have taken effect to produce a more reader-friendly document
with variable-width characters and larger fonts for the title,
and indents for quotations.

Notes:

A HTML Tag is a special formatting text segment such as BODY
surrounded by left and right Angle bytes to become <BODY> or
</BODY> to end a "body" segment.

File TXT2HTM.DEF has pattern definitions that include text
files BODYSTRT.TXT, BODYEND.TXT, HDRSTART.TXT and HDREND.TXT.

[ < < < Home ] [ < < Reference Start ] [ < Reference Contents ]
[ < Previous=Examples ] [ Next=NLX,Strings or Head Examples > ]

Intelligence Services

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