home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 6 File
/
06-File.zip
/
EX2.ZIP
/
EX2.DOC
next >
Wrap
Text File
|
1989-12-18
|
4KB
|
111 lines
EX2 - Binary File Replace Utility for OS/2
==========================================
General:
EX2 is an easy to use binary file replace utility. The program is
written in pure assembler, a fact which guarantees a very small
program size and the fastest execution possible.
EX2 is intended to be used with binary files (you can use it of course
with text files too) of any size (up to the limit imposed by the
operating system).
EX2 is the successor to EX, which is a program doing the same as EX2
under MS/DOS.
EX2 uses the standard streams STDIN and STDOUT for input and output.
STDIN and STDOUT are normally assigned to the console (keyboard and
screen). They can be redirected and this EX2 expects.
Usage:
EX2 <inputfilename >outputfilename search-string replace-string
Where:
inputfilename: name of an existing file
outputfilename: name of the file where the modified content of the
input file will be written to. If the file already
exists the old content will be discarded. If the file
doesn't exist it will be created.
Important!!!
Never use the same name for input and output
file. This would lead to a destruction of the
content of the file.
search-string:
replace-string: The search- and replace-strings must be continous
sequences of characters, which are permitted to occur
on a command line as normal characters. For example:
following characters are not allowed as parts of the
search- and replace-strings:
(SPACE),(TAB),?,*,;,<,>,etc.
Please consult your OS/2 user manual for a detailed
description.
This notation doesn't restrict you to normal
characters. (This wouldn't be the right way for a
'binary' replace utility).
Whenever you want to define a character not permitted
to occur on a command line or if you know only the
HEX-value of the character you can use the following
representation: #Hex-value (2 digits)
For example: #0A (or #0a) is the valid representation
of LINE-FEED.
At process termination EX2 will return one of the following return codes:
Exit-Code Indication
0 Everything worked fine, no error
1 Error: No search string found
2 Error: Couldn∩t allocate memory
3 Error: Couldn∩t read from STDIN
4 Error: Couldn∩t write to STDOUT
5 Error: Invalid token in search or replace string
How to use:
1. Example:
You have a lot of text files and you want to replace every occurrence
of CR+LF with LF and every occurrence of a TAB with 4 SPACES.
You can proceed in two ways:
- You call the program EX2 two times per file.
- You write a batch-job which calls EX2 two times per file:
Batch File:
EX2 <%1 >temp #0D#0A #0A
EX2 <temp >%2 #09 #20#20#20#20
del temp
To call this batch file you must type:
'batchfilename' 'inputfilename' 'outputfilename'
- You call EX2 two times at once by using the piping feature
EX2 <∩input∩ #0D#0A #0A | EX2 >∩output∩ #09 #20#20#20#20
2. Example:
You have a file and you want to replace every occurrence of the string
'Main Menu' with the string 'MAIN MENU':
EX2 <'inputfilename' >'outputfilename' Main#20Menu MAIN#20MENU
Please report any problems or suggestions to:
The author
Franz Krainer FidoNet 2:310/11.17