From: SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 5-JUL-1994 10:05:21.70 To: EVERHART CC: Subj: RE: TECO for the newbie Message-Id: <9407020305.AA20733@uu3.psi.com> Date: Fri, 1 Jul 94 22:52:27 EDT From: Jerry Leichter To: INFO-VAX@SRI.COM Subject: RE: TECO for the newbie X-Vms-Mail-To: UUCP%"ichjsmt@earth.oscs.montana.edu" > PROBLEM DESCRIPTION > From: EARTH::ICHJSMT > To: HELPDESK > CC: > Subj: TECO > So, now I heve a 5.5MByte file. And I want to examine it. > EDT and EVE (TPU) apparently can't handle it. I assume TECO > can. I've never used TECO. > > Where can I get information on TECO. ^ IMPORTANT CLUE! _ _ _ _ _ _ _ _____| (Should be "?") > > Mark Tarka > > > > SOLUTION DESCRIPTION > The TECO editor is documented in the "PDP-11 TECO Editor Reference > Manual". We do not have any PDP-11 documentation, so that manual is > not available here. That just happens to be the name on the document, mainly because it was never re-issued after the native-mode VAX TECO became available. The document is an official part of the VMS documentation set, though it's an optional one that doesn't ship with VMS. However ... lucky you ... the document was turned over to DECUS, and is now available by FTP! Pete Siemsen (siemsen@usc.edu), who's developed a portable C implementation, maintains a set of TECO archives; I think they are in the anonymous FTP directory on usc.edu. All I really need to do at this time is: (1) get the file into the editor; (2) page through that file (is there a FIND or SEARCH function?); (3) exit the editor. TECO is not easy to learn quickly (or at all, I suppose). Very briefly: - The TECO command prompt is *. - The ESCAPE character, echoed by TECO as $, is essential to the use of TECO. *Every $ you see below is an ESCAPE!* The dollar character itself has no meaning to TECO. If your keyboard, like most recent ones, has no ESCAPE key, type CTRL/[. CTRL/3 will also work on DEC terminals. - TECO will not start executing what you've typed until you type $$. (ESCAPE ESCAPE - last time I'll point this out.) RETURN has no special meaning to TECO. - VMS supports the EDIT/TECO with a standard editor syntax. See the HELP on this topic. Briefly, EDIT/TECO[/READ_ONLY] will start TECO with as the input file (producing a new version as the output file is you haven't included the /READ_ONLY qualifier). - The reason TECO can handle very large files is that it doesn't attempt to read the entire file into memory. Instead, it operates a "page" at a time, where a "page" is nominally terminated by a formfeed, but will be cut short if memory fills. The contents of memory are called the "buffer"; TECO limits the buffer to 65635 bytes. The P command writes the current page out and reads the next one. There is a -P command to go back by a page. (More generally, nP, where n is a decimal number, repeats the P operation n times - or the -P operation -n times, if n is negative.) You can't use the P command if you have no output file. The Y command discards the current page and reads the next one. You'll find that you can't use it when editting a file, only when accessing it read-only. (This is a safety feature, as it's very easy to lose edits as a result of misplaced Y commands.) There is no nY command (for safety), and no -Y. - There are actually several search commands, and some complex search constructs; but you don't want to get into that. The basic search command is Sstring$, which searches for "string" from your current position in the buffer, but only within the current buffer. String matching is case-insensi- tive. If it doesn't find "string", TECO prints an error message and resets your current position to the beginning of the buffer. nSstring$ looks for the n'th occurence; -Sstring$ searches backward. Nstring$ is just like S, except that if no match is found, TECO does an implicit P command and keeps searching in the next buffer. It will search until the end of the file, and if "string" doesn't occur, will leave you with an empty buffer, positioned beyond the end of the file. (-P at that point will put you back in the last page of the file.) Constructions like -Nstring$ work as you'd expect. _string$ is like Nstring$ except that it uses Y, not P, if it fails to find a match. After any successful search, your "current position" will be just after the string matched. Note that search strings can contain linefeeds and such. TECO is a stream editor, not a record editor. While there are line-based commands, lines do not play a central role in TECO as they do in many other editors. Note also that the search commands are terminated by $'s. This is a second role for $. A $ that terminates a search string may also be the first of two $'s that terminates a command line; but it needn't be. Other commands can follow the search command. (They won't be executed if the search fails.) - The V command displays the line containing the current position. More generally, nV displays a window of 2n lines centered around the current position. - EX exits normally from TECO. Logically, it does repeated P's until it's exhausted the input file, then exits. If there's not output file, EX will produce an error. The usually way to exit in this situation is to type HKEX$$. HK deletes everything in the buffer. EX will then exit, even if there actually is an open input file. You can, of course, also type CTRL/Y in this case. The above barely scratches the surface of TECO. If you describe exactly what you want to accomplish, I may be able to give you a more specific set of commands. -- Jerry