home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
SNR301.ZIP
/
SNR.DOC
< prev
next >
Wrap
Text File
|
1989-11-03
|
14KB
|
288 lines
TITLE: SNR.EXE VERSION: 3.01
PURPOSE: Multiple simultaneous Search 'N' Replace program
DATE: 11/3/89
AUTHOR: Thomas A. Lundin
9129 Colfax Avenue South
Bloomington, MN 55420
Day phone: (612) 588-7571
DONATION: $10 requested
DESCRIPTION: SNR is a multi-string search-and-replace filter. Both
text and binary files can be processed by the program,
since SNR allows the definition of hex values in a
search-and-replace equation. Up to 50 equations can be
entered into an SNR table, each of which can be a maximum
of 200 characters in length. The multiple
search-and-replace operations are performed in a single
pass.
REVISION 3.01 - 11/3/89
HISTORY: Program recompiled for family mode, meaning it will run
as-is under DOS, OS/2 real mode, and OS/2 protected mode.
Also improved I/O throughput on fast disk drives.
3.0 - 9/27/89
The program has been completely rewritten. The pesky bugs
that were present in versions 1.5 and 2.0 have been
eliminated.
All binary characters INCLUDING NULLS can now be searched
and replaced. Nulls can also be entered as part of a
larger search-and-replace equation.
The equation length has been increased to 200 characters,
which can be split into search and replace sides of any
length, as long as the total does not exceed 200.
Equations no longer need to be in any specific order.
The average speed of the program has been vastly
improved, especially for multiple and high-occurrence
search and replaces.
An automatic "bit-stripping" feature has been added which
removes the high-order bits from input characters,
forcing 8-bit codes into 7-bit ASCII. THIS IS NOW THE
DEFAULT ACTION, but this feature can be disabled for
binary files.
The program no longer needs to read itself for runtime
parameters.
OPERATION: The command line invocation is:
snr [@]filename ext tablename [/d] ─┘
1. "filename" is any unambiguous DOS path/file name. An
optional at-sign (@) in front of the filename indicates
that multiple files are to be processed from a directory
list file, i.e., a file that has been created from a
redirected DIR command. For example, the DOS command
dir *.txt >dirfile ─┘
will create a disk file named "dirfile" which contains a
directory of all files with a ".TXT" extension.
2. "ext" is the filename extension you wish to assign each
output file. The output files are created using the name
of the input file plus the extension specified here. The
choice of an extension is important; if you accidentally
choose an extension which is already used by an input
file, the result of the process is indeterminable,
although file data loss is likely to occur. Use an
extension which is sure to be unique.
Extensions can be the DOS device names CON, NUL,
AUX, and PRN. In any of these four cases, an output
file is NOT created on disk; rather, the output is
redirected to the console (CON), nowhere (NUL), the
rs232 port (AUX), or the printer (PRN). Using CON is
handy for a quick preview of the conversion process
before storing it to disk.
NOTE: If you preview converted binary files to CON,
be aware that hex code 1A (DOS end-of-file) will
terminate the conversion display, perhaps
prematurely. This permature termination will NOT
occur when you store to disk.
3. "tablename" is the unambiguous DOS path/file name which
contains the string translation "equations". Although no
restrictions are placed upon the tablename, for sake of
clarity it is suggested that you adopt a consistent naming
scheme for them, (say, with an *.SNR extension). Tables
are discussed in more detail below.
4. "/d" is an option which replaces the original input file
with the converted data. The EXT specified on the
command line is thus used temporarily until the conversion
is complete, at which time the program performs an
internal file delete/rename operation.
EXAMPLES...
C>snr tstfil.doc txt tst.snr ─┘
The above command line will process the input file
"tstfil.doc" and create an output file "tstfil.txt" using
the table "tst.snr".
C>snr @dirlist p1 sample.snr ─┘
The above command line will process a group of files
contained in the directory list "dirlist" and create a
group of output files with extensions of *.p1 using the
table "sample.snr".
CONVERSION SNR tables are ASCII text files which contain the
TABLES: search-and-replace equations used by the program. Up to
50 of these equations can be entered in a single table;
each equation can consist of 200 characters split freely
between the search side and the replacement side. Blank
lines will be ignored by the table processor. A sample
equation would be:
Now is the time=NOW IS THE TIME
It should be obvious that this equation will translate an
upper-and-lower case version of the words "now is the time" to
an all-upper-case string. Notice that spaces ARE SIGNIFICANT
characters in an equation. A search string can be defined to
output nothing, simply by leaving out a replacement string:
Now is the time=
If spaces are desired at the end of a replacement string,
and you want to be sure they are there, they can be
defined as hex codes:
Now is the time =NOW IS THE TIME\20
Any hex code can be formed from a backslash followed by two hex
digits (0-9, a-f, A-F). For instance, a carriage return/line
feed sequence (CRLF) can be specified like this:
\0d\0a\0d\0a=\0d\0a
The above equation will convert two CRLFs in a row to a
single CRLF. A consequence of using the backslash
notation for hex codes is that the backslash character
itself must be specified in a string as \5c. Likewise,
the equals sign must be specified in a string as \3d.
The end of a table is signified by a \\E on a line by itself.
This code is optional, but recommended, since it will prevent
the table processor from inadvertently reading past the end of
your equations (some word processors may pad their last blocks
with garbage, which the table processor would attempt to read
as equation data).
Comments can be entered in a table as lines by themselves, or
set off from an equation:
\ This is a comment line by itself.
\ A comment consists of a single backslash
\ followed by one or more spaces.
\0d\0a=\0d\0a \ this will ensure that existing CRLF pairs are
\ left untouched
\0d=\0d\0a \ this equation will convert an isolated CR
\ into a CRLF
\0a=\0d\0a \ this equation will convert an isolated LF
\ into a CRLF
\\E
Equation ordering is immaterial. SNR will automatically
sort equations by length when assembling a table in
memory.
BIT-STRIPPING...
SNR's default action is to map all incoming characters to
7-bit ASCII before running them through the equations.
This is handy if you're converting an old Wordstar file,
and don't want to deal individually with the tagged
characters.
This action, however, is not at all welcome when you're
dealing with files that make use of specific binary
characters (examples: Word Perfect, XYWrite, others). In
cases where you DON'T want 7-bit mapping to occur, type a
\\L8 as the first line of a table; this will disable
bit-stripping for that table.
An interesting side-effect of the bit-stripping feature
is illustrated by the table STRIP.SNR. It contains NO
equations at all (except for the \\E), and yet it will
effectively remove the high-order bits from any file that
it is run through. Try it!
NOTES: The program will run on any IBM PC/XT/AT series computer
using MS-DOS 2.x or higher, with a minimum of 128K RAM.
SNR was compiled with Lattice C 6.01.
DISCLAIMER: This program is distributed as shareware. Use it, copy
it, upload it, give it to your friends. Please distribute
only the complete program in ZIP form, including all
document and sample files. No warranties, either
expressed or implied, are given by the author or
distributor of the program, and the user accepts all risk
of damage arising out of the application and use of the
program.
CONTRIBUTION: If you like the program, contributions in any amount ($10
requested) will be gratefully accepted. I would hope that
you get at least that much value out of it. Please make
checks payable to Thomas A. Lundin and mail to the address
shown at the top of this DOC file.
COMMERCIAL: SNR contains a small subset of the capabilities of
SuperConverter, a program that is available as a
commercial purchase through the company I work for, whose
phone number I've listed below. If you like SNR, you'll
love SuperConverter.
For $149, SuperConverter allows up to 2,500
search-and-replace equations per table, and each equation
can consist of up to 4,999 characters. SuperConverter's
other features include:
WILD CARD MATCHING: search and replace on general
patterns of characters such as numbers, alphabetic
characters, control characters, printable characters,
punctuation, etc. -- eleven wild card types in all.
FLAGGING: 16 toggle flags allow you to search
identical input equations and replace them with
different outputs, depending on whether a flag is on or
off. For example, you can make a double-quote character
be replaced alternately with left and right single
quotes.
VARIABLE-LENGTH SEARCH-AND-REPLACE: convert a string of
unknown length and treat it as a block of data. Then you
can add codes to either side of the block, or re-arrange
several blocks (such as tab-delimited fields), or remove
the blocks from output.
...AND MORE!
SuperConverter has been used to process files for
typesetting and disk conversion at my work since 1982.
Commercial purchasers will receive a printed manual and
over 30 useful sample tables.
SuperConverter comes with a 30-day money-back guarantee.
For more information, call me at work at the number
listed below (8am-5pm Central Time, Mon-Fri).
(Prices subject to change.)
-----------------------------------------------------------
Send comments/bug reports/contributions to:
╔══════════════════════════╗
║ Thomas A. Lundin ║
║ 9129 Colfax Avenue South ║
║ Bloomington, MN 55420 ║
║ Daytime # (612) 588-7571 ║
╚══════════════════════════╝
You can also reach me at my BBS home base:
PC-ROCKLAND BBS
If you can't find a program here,
it probably doesn't exist!
(914) 353-8153
(Leave msg. for "Tom Lundin")
Thank you for using SNR.