Following the success of my 'vi' bluffer's guide, I thought I would take a stab at a 'TECO' guide as well. TECO is a very different beast to vi so unfortunately I couldn't just hack up the old document. Most people wouldn't believe it is possible to write a bluffer's guide to TECO and after this I believe them. I have had to simplify some things beyond all reasonable levels of sensibility, forget whole chunks and make my head hurt a lot working out how to explain some things. With luck, I have done it without resorting to obscenites too often.
This is definitely not a full guide to TECO, Digital have written a perfectly good one of these that is really quite readable but this guide aims to be a simple, readable guide and nothing much more. If you read and understand all of this you won't be an expert, nor will you be doing things the right way but you will be able to use TECO for most everyday tasks which is more than most people can say. TECO can be pretty unforgiving, I would advise you to edit things in small chunks, save them and then re-edit. Remember, if all else fails a couple of Control-C's should help.
All the examples here are from a DEC-10/PDP-10 running TOPS-10 but TECO will run on VMS and Unix machines as well as many other weirdo operating systems and all the things in this guide should work on them all.
Throughout this text, anything you are expected to type will be underlined, this is because I am a bit lazy and it's the easiest way to format it. There is no case sensitivity in TECO so the "fn" command is the same thing as the "FN" command and even the "fN" and "Fn" commands.
I'll follow the usual convention of representing the ESCape key as the symbol "$" in this document. ESCape is used as a command terminator in TECO, but more of that later. ESCape is important, Carriage-Return/Line-feed are not so it is vital that you kick yourself in the head a few times to force it into your mind the fact that NEWLINE, RETURN, ENTER or whatever you are used to is of about as much significance to most bits of TECO as Halley's Comet is to a stuffed Elephant.
TECO is a bit fussy about the key you use to delete text when you are using it. It is best to work out straight away what yours wants in the terminal setup you are in - Connecting to a DEC-10 using SecureCRT from a Windows box, mine wants me to use the "Delete" key on the little keypad rather than the usual Windows "<--" key. The best way to test this it to go into TECO by just typing: TECO and, at the "*" prompt type the word "hello" and then press what you think will be your delete key SIX times. If you get a new "*" on a newline, then you have it right. If not, hit Control-C a couple of times, and try again. It is a good clue that you have the right delete key if it starts to echo the word "hello" backwards as "olleh" - This is how TECO shows you it has deleted a character, by echoing it back at you... If you think this is screwed up, we haven't even started yet.
TECO was designed for systems that potentially had very low memory. It operates by reading a "page" at a time into memory to edit. Pages are separated by form-feeds however, if TECO is worried about memory it will also split a file completely of its own demented reasoning just to make life complicated. You can get into huge problems by accidentally throwing pages away so, going against all design considerations of TECO the first thing this guide will advise is that you forget all the page nonsense and read the whole document into memory. It should be noted that this is a very bad thing to do, but it works so unless you are sick or you have a file that has form-feeds in it, just do it. I will add a little bit at the end telling you how to use TECO in page mode if you really do have to edit things with form-feeds in or use low memory systems.
TECO was not designed with the considerations of the Cathode Ray Tube in mind. Those are the television sets you have on your desk, with a keyboard attached to them that show pictures from your computer. TECO was designed when the idea of letters appearing on those screens was just coming out of the realms of science fiction. If you were lucky, your access was via a teletype (that's a typewriter with wires coming out of it) and if you were unlucky, you used punched tape or cards. Bear this in mind when TECO does weird things like echo your deleted characters to you backwards because this is why. You can also bear it in mind when insulting it since if you know anything about Dinosaurs it will give you a much wider vocabulary pool from which to pick out your obscene references.
TECO commands are all one or two letter commands. Some commands can take a numeric argument which prefixes the command, some take an alphanumeric argument which follows the command and many take both. All commands are separated by an ESCape, and commands can be joined together into something called a command-string. When you actually want TECO to execute the command you terminate the last terminated command with another terminator (ie: you press ESCape twice) and TECO will run off and do your bidding. The numeric prefix to most TECO commands usually tells the command to execute that number of times but in its perversity TECO doesn't allow this with some commands but at the same time it gives us a really easy way of making it do it anyway. Such is TECO.
Many people refer to TECO as a line-editor. These are naive people for whom the world is made up of screen-editors and line-editors and they probably also think that the moon is made of cheese. TECO is a character-editor. A screen-editor is an editor where you can move the cursor around on the screen with a mouse, cursor keys, a little pen or even a pert little red raspy-feeling nipple spunging hard and erect from an IBM keyboard. A screen-editor is generally very easy and logical to use. A line-editor is an editor where you work on your text document a *line* at a time, you make changes in a line, and you move onto another one; it sounds complicated but really it's not. Now a character-editor is what you would get if you tried to run a screen-editor on a typewriter terminal; it requires you to remember where your "cursor" is within a line, as well as what line it is on and to make it even more exciting, you can't actually see a cursor. Do you remember me saying to forget all concepts of your Return key? Well now you know why but... to confuse you later, TECO does also deal with lines as lines sometimes just to put you off guard when you think you have it all worked out.
Presumably most people have given up any hopes of ever learning TECO now and decided to go back to MS-Word or even vi. For those poor sods who really have to use TECO though, let's get down to business.
This will hurt I promise you, but I will try and make it quick.
. MAKE NEWFILE.TXT will create a new file called "NEWFILE.TXT".
. TECO OLDFILE.TXT will edit the existing file "OLDFILE.TXT".
When you edit an existing file, TECO will make a copy of the original file and give it the extension ".BAK". TECO will not allow you to edit a file with the ".BAK" extension so if you need to recover it you'll need to rename it. If you are on a decent TOPS-10 system and want to avoid using PIP then the easiest way is:
. RENAME FILE.TXT=FILE.BAK
Now you have actually gotten into TECO, it will prompt with a "*" and here, your real troubles will start.
(The * is the TECO "ready" prompt which you don't type, and the $ means press ESCape - If we ever have to use a $ sign in this guide, we'll worry about how to represent it then).
What this actually does is to call the "Append Page" command 10,000 times in a loop. The "A" command doesn't have a numeric argument like most TECO commands do just to stop us doing this - So we simply cheat a little.
To be strict, we shouldn't really do this but we are doing, and most of the TECO purists died out in the 70's anyway so who is there to complain?
Assuming you have just loaded a file and loaded in all of the pages, the pointer will be just in front of the 1st character in the file. If this was a screen editor, it would be in the top left of the screen.
... Lots more ...
© 2003 Michael Lawrie