The TECO (TExt COntext) editor is a non-visual, character oriented
editor which was developed at the Massachussets Institute of Technology in
the late 1960s as part of a project in artificial intelligence. When fully
implemented, TECO supports conditionals, branching, and forms its own unique
programming language, in fact EMACs was originally written in TECO !!! My
version is considerably simplified from full-blown TECO, but it still is
very powerful, allowing the user to edit BINARY (ie .EXE) as well as simple
ASCII files, changing the value of arbitrary bytes anywhere in the file.
To start editing in my version of TECO, you must give a file
specification on the command line. Do this by typing either
if you want to edit "myfile.ext", or you can type
where "outfile.ext" is the output file, and "infile.ext" is the source
file. To create a file from scratch, enter the command
where "newfile.ext" is the new file, and "NUL" is the null device.
Congratulations!! You are now in TECO mode, and can start using
the TECO command set. TECO commands are character sequences of the form
number letter string ESC
where "number" is signed number which defaults to 1 if not specified,
"letter" is a valid TECO command, "string" is the object for the command,
and "ESC" is the escape key (which echoes as $ on the console display).
Commands sequences are not executed immediately, but are stacked in a buffer
for later execution. All the TECO commands stored in the buffer are then
executed at once when the user types two ESC characters. The TECO commands
num A - Appends "number" pages of text to work area
from the input file, where a "page" is
defined as an arbitrary number of bytes,
ending in "Form Feed"
num C - Advance "number" characters in the page.
num D - Delete "number" characters.
EF - Exit TECO without writing this page to
the output file
EX - Exit TECO, writing this page out and
then copying the remainder of the input
file to the output file. Normal TECO exit
num FS old ESC new ESC - Replace string "old" with string "new"
a total of "num" times. Replace fails if
string "old" not on current page.
num FN old ESC new ESC - Replace string "old" with string "new"
a total of "num" times, Paging in text
HK - Delete everything in the current page.
HT - Type everything in the current page.
num I - Insert a single ascii character whose value
is "number" into the page.
I text ESC - Insert "text" from buffer.
num J - Jump to position "number" in page. If
"num" is omitted, go to start of page
num K - Kill "number" lines from the page.
num L - Advance "num" lines in page.
num N string ESC - Search for "string" a total of "num" times
Go to end of file if needed to find "string"
num P - Write page to the output file, and read in
a new page from the input file. Do this
a total of "num" times.
num R - Go backward "num" characters in the page
num S string ESC - Search for "string" a total of "num" times,
with error if not found on current page.
num T - Type out next "num" lines in page
num V - Type out "num" lines preceding and "num"
lines following current location in page.
num < string ESC > ESC - Iterate the "string" TECO command(s) within
angle brackets a total of "num" times.
If "num" not specified, iterate forever.
This is a *VERY POWERFUL* command.
^C - Exit TECO and delete output file. The
input file will be left untouched...
There are also some characters which assume numeric values. These are:
B - This is a synonym for 0 (zero)
Z - This is the number of characters in
the current page
. - This is where you are in the page.
(this version of TECO does not support arithmetic with numeric values.)
To cancel TECO typeout, hit CTRL-O, and all output will be suppressed
until the next TECO command string is requested from the console.