Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!haven!adm!xadmx!postmaster@sandia.gov From: postmaster@sandia.gov (SMTP MAILER) Newsgroups: comp.unix.questions Subject: Mail not delivered yet, still trying Message-ID: <21121@adm.BRL.MIL> Date: 12 Oct 89 18:07:54 GMT Sender: news@adm.BRL.MIL Lines: 1857 ----Mail status follows---- Have been unable to send your mail to , will keep trying for a total of three days. At that time your mail will be returned. ----Transcript of message follows---- Date: 12 Oct 89 05:53:00 MDT From: info-unix@BRL.MIL Subject: INFO-UNIX Digest V8#090 To: "omalley" Return-Path: Received: from SEM.BRL.MIL by sandia.gov with SMTP ; Thu, 12 Oct 89 04:51:20 MDT Received: from SEM.BRL.MIL by SEM.brl.MIL id ab20946; 12 Oct 89 2:59 EDT Received: from sem.brl.mil by SEM.BRL.MIL id aa20850; 12 Oct 89 2:46 EDT Date: Thu, 12 Oct 89 02:46:20 EST From: The Moderator (Mike Muuss) To: INFO-UNIX@BRL.MIL Reply-To: INFO-UNIX@BRL.MIL Subject: INFO-UNIX Digest V8#090 Message-ID: <8910120246.aa20850@SEM.BRL.MIL> INFO-UNIX Digest Thu, 12 Oct 1989 V8#090 Today's Topics: Re: Honey-Danbear UUCP Availability Getting the most for a process. Re: pic Re: Version 9 Unix cut for BSD Re: Getting the most for a process. Re: Stupid awk question Making a named pipe over NFS Re: home unix on the cheap Re: Bourne shell question Re: Getting the most for a process. Re: Stupid awk question Looking for the program "gone"... recommendations wanted printf() with vector arguments. Re: Making a named pipe over NFS SUN QUESTION: CDC Sabre 1.2 Gigabyte drives w/ Xylogics 753 ctrlr upper limit of NFILE and NINODE on 286? Re: TcP/Ip UNIX backup to unattended 8mm tape drive Re: Stupid awk question Re: Reversing a file? Vi Reference - version 6 Dutch Vi Reference available Vi Reference - version 6 Re: Reversing a file? ----------------------------------------------------------------- From: Harry Skelton Subject: Re: Honey-Danbear UUCP Availability Date: 10 Oct 89 11:41:19 GMT Keywords: uucp unix To: info-unix@sem.brl.mil Even our machines, with current release of 3.2 Sys V, does not have HDB. Our vendor stated that they did not plan to support it or they'll support it in a 4.x release (eons down the road). It may be to your advantage to get something like the other PD uucp's and hack it for your machine. I'm using a uupc hack to build it up to HDB stanadard w/ zmodem. With normal work hours and home life, I don't think it will be finished anytime soon. I'll post to alt.sources when I get it running. -- Harry Skelton - Senior Systems Administrator - U.S. Dept. of Transportation ..!attctc!tons61!harrys ..!obdient!tons61!harrys ..!tfd!tons61!harrys [ Views expressed by Harry Skelton are not those of the US Gov. or CBSI ] ----------------------------- From: Doug Perlich Subject: Getting the most for a process. Date: 10 Oct 89 20:18:01 GMT Keywords: Dedication, priority. To: info-unix@sem.brl.mil I have recently become interested in having an application program run as fast as possible! (Sound familiar)? What I am interested in is how can a program get a higher priority at run time. More exactly what other methods are there to get screaming performance out of a UNIX machine. As I understand it only root can use a negative nice to make a program run faster, are there ways of dedicating a processor (w/ or wo/ a multiprocessor)? I am mainly interested in a multi-user system. It seems to me the answer is no because then every programmer would try this in his/her code and the system would halt. -Doug. . . ----------------------------- From: Doug Gwyn Subject: Re: pic Date: 11 Oct 89 06:47:54 GMT To: info-unix@sem.brl.mil In article <46215f96.81da@digital.sps.mot.com> chen@digital (Jinfu Chen) writes: >Every once a while I find some *roff documents include simple pictures >to be processed via `pic'. Where's this `pic' program comes from? "pic" is part of the Documenter's WorkBench package licensed by AT&T. Sometimes DWB is bundled with a vendor's implementation of UNIX, sometimes it is available from the vendor as an extra-cost option, and sometimes you have to turn to a third party (e.g. Elan, SoftQuad) to obtain it. I know of no public-domain implementation of "pic". ----------------------------- From: Doug Gwyn Subject: Re: Version 9 Unix Date: 11 Oct 89 07:01:34 GMT To: info-unix@sem.brl.mil In article <1989Oct10.215504.3391@sdsu.edu> arul@sdsu.edu (Arul Ananthanarayanan) writes: >I am curious as to what Version 9 Unix is like. I hear that it is run >in-house at Bell Labs. >Is it similar to System V, or BSD4.3? >Pointers to any papers would be greatly appreciated. Ninth Edition Unix evolved from the Eighth Edition, which evolved from 4BSD. Along the way, many modifications and additions occurred, among them the "streams" I/O subsystem (precursor of System V STREAMS), file system switch, network filesystem, processes as files, Blit support, and much more. Apart from the BLTJ special issue on Unix (not the BSTJ special issue!), papers can be found in many of the USENIX Conference Proceedings and in a few other journals. The Tenth Edition of the Unix documentation is being prepared now (the system itself undergoes continual evolution; the hardcopy documentation is officially updated every so often). UNIX System V Release 4 will include much of the Ninth Edition's facilities, generally in somewhat revised form. ----------------------------- From: Quang Ngo Subject: cut for BSD Date: 11 Oct 89 07:54:51 GMT To: info-unix@sem.brl.mil There is a cut command for System V, but not for BSD. Is there such a command for BSD that acts like cut? Thank you, Quang Ngo^ ******************************************************************************** /* * email = quang@csufres.csufresno.edu * quang@redwood.UUCP */ ******************************************************************************** ----------------------------- From: George Seibel Subject: Re: Getting the most for a process. Date: 11 Oct 89 08:31:31 GMT Sender: daemon@cgl.ucsf.edu Keywords: Dedication, priority. To: info-unix@sem.brl.mil In article <593@cogent.UUCP> doug@cogent.UUCP (Doug Perlich) writes: >I have recently become interested in having an application program run as fast >as possible! (Sound familiar)? Yup. >What I am interested in is how can a program get a higher priority at run time. >More exactly what other methods are there to get screaming performance out of >a UNIX machine. >As I understand it only root can use a negative nice to make a program run >faster, are there ways of dedicating a processor (w/ or wo/ a multiprocessor)? > >I am mainly interested in a multi-user system. > >It seems to me the answer is no because then every programmer would try this >in his/her code and the system would halt. Even if you get 100% of the machine, you only go as fast as the machine will run your program. Here's what to do if you *really* want to go fast: 1) Choose the best algorithm. e.g. Quicksort beats Bubble sort... 2) profile the application with representative inputs. The usual scenario is: cc -p applic.c -o applic [could be f77 or pc instead of cc] applic [will produce file "mon.out"] prof applic > prof.out Now look in prof.out. This should tell you where your program is spending its time. Look at those parts of the code. Are they doing unnecessary work? Find a hacker and ask how to make it go faster. Bringing frequently-called functions inline is usually a win. If you're doing a lot of I/O, can it be brought in-core? Can you use binary files instead of formatted files? Check out the options on your compiler. Try the optimisation options. Make sure you are not using runtime bounds checking. Are you even using a compiler? If the application is written in an interpreted language, there probably is no profiler or optimiser. Consider rewriting. What if you aren't a programmer, or you don't have the source code? 3) Buy a faster computer. (This is also a valid solution if you *are* a programmer) George Seibel, UCSF ----------------------------- From: "Jonathan I. Kamens" Subject: Re: Stupid awk question Date: 11 Oct 89 06:48:16 GMT Sender: news@bloom-beacon.mit.edu To: info-unix@sem.brl.mil In article dmaustin@vivid.sun.com (Darren Austin) writes: >Hi all, > I am trying to split up a large output file into several >smaller files. The smaller files are named after the value in >the second field. I tried using the following simple awk script, > >(current == $2) {print > current".summary"} >(current != $2) {close(current".summary");current=$2;print > current".summary";} > >but it fails with > >awk: too many output files 10 Allow me to quote from "Awk -- A Pattern Scanning and Processing Language (Second Edition)", by Alfred V. Aho, Brian W. Kernighan, and Peter J. Weinberger. I got my copy out of /usr/doc on my system. Page 2, on section 1.4 about printing, says, "Naturally there is a limit on the number of output files; currently it is 10." A lot of implementations have overcome this limitation. Apparently, the version of awk you are using has not. May I suggest either nawk (I don't know where/under what conditions that's available), or gawk (available for nothing whereever fine GNU products are distributed)? Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-4261 Home: 617-782-0710 P.S. Despite the title you gave it, it's not really a "stupid" awk question, especially since the man page doesn't even appear to mention this limitation, or at least not that I could find. ----------------------------- From: Richard O'Keefe Subject: Making a named pipe over NFS Date: 11 Oct 89 12:35:34 GMT Sender: news@cs.mu.oz.au Keywords: /etc/mknod, fifo, NFS, SunOS To: info-unix@sem.brl.mil I am using a Sun-3/50 called mudla. Here's what /etc/motd says about it: SunOS Release 4.0_Export (MULLO_CLIENT_50) #1: Wed May 24 18:23:08 EST 1989 My files are held on a file server called mullauna, an Encore Multimax, and are accessed through NFS. Here's what I see when I log in on mullauna: UNIX System V Release ax.2.2f ns32332 Now, SunOS supports named pipes, and System V supports named pipes, and the network is the computer, so named pipes should work, not so? No. On mullauna (the server), in my home directory: % rm -f zabbo % /etc/mknod zabbo p % file zabbo zabbo: fifo just as I would expect. On mudla (the client), in my home directory (the same directory): % rm -f zabbo % /etc/mknod zabbo p % file zabbo zabbo: empty This came as a rather unpleasant surprise. To check whether SunOS really does understand named pipes, I tried % rm -f /tmp/zabbo % /etc/mknod /tmp/zabbo p % file /tmp/zabbo /tmp/zabbo: fifo mudla's /tmp is served from another Sun-3. Is this supposed to work, or should I just forget about named pipes? ----------------------------- From: Wm E Davidsen Jr Subject: Re: home unix on the cheap Date: 11 Oct 89 15:05:33 GMT To: info-unix@sem.brl.mil In article <34345@srcsip.UUCP>, jkimball@SRC.Honeywell.COM (John Kimball) writes: | I've started to think about acquiring a home Unix machine, to replace my | CP/M machine. | | The main purposes would be | o email and news | o ability to run most of the freely-redistributable software we use | at work (mainly GNU stuff) If you really only want what you describe, buy a used unix-pc. It's slow and somewhat limited, but it will do what you want and should be <$1000 for the machine and software. If you want more performance buy a cheap 386 and cheap UNIX. The unmodified SysV versions like ix/386 and ESIX have the AT&T compiler, Xenix has it's own, more ANSI features, cross compiles to DOS, costs more. Having used both I find about the same number of bugs in each, but diferent bugs. If you don't need ANSI or DOS go with the regular SysV or SCO UNIX, has both compilers and does OS/2 (whoopee?). If you want cheap BSD look for a refurbished Sun-2. A friend of mine got one with mono and color for about $2k. They are advertised in the magazines from time to time. Repair ====== unix-pc - good luck. There are places which do it. 386 - warantee, lots of places repair. Sun-2 - ask locally, it varies. Usually not cheap. -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon ----------------------------- From: "Conor P. Cahill" Subject: Re: Bourne shell question Date: 11 Oct 89 12:06:12 GMT Keywords: pipe, logical 'or' and " pg ". To: info-unix@sem.brl.mil In article <1943@sactoh0.UUCP>, jak@sactoh0.UUCP (Jay A. Konigsberg) writes: > > When the pipe into " pg " is removed it works ok, but I would like > to keep the pg in the script. Your problem is that pg always exits with a 0 (at least I could not get any non-zero exit) and therefore the stuff to the right of the || will never be executed. You could do the following: (ls -l | grep "^d" || echo "There are no subdirectories" ) | pg or you could re-write the script so it used more than 1 line: ls -l | grep "^d" > /tmp/sh$$ if [ $? = 0 ]; then pg /tmp/sh$$ else echo "There are no ..." fi rm /tmp/sh$$ -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+ ----------------------------- From: Jim Frost Subject: Re: Getting the most for a process. Date: 11 Oct 89 19:06:12 GMT Followup-To: comp.unix.questions To: info-unix@sem.brl.mil In article <12034@cgl.ucsf.EDU> seibel@cgl.ucsf.edu (George Seibel) writes: |In article <593@cogent.UUCP> doug@cogent.UUCP (Doug Perlich) writes: |>More exactly what other methods are there to get screaming performance out of |>a UNIX machine. | |Even if you get 100% of the machine, you only go as fast as the machine |will run your program. Here's what to do if you *really* want to go fast: Very valid techniques. There are others that may work depending on your application which can squeeze even more performance out of your machine. UNIX splits up the CPU amongst processes (and threads if your UNIX supports them). A single application can thus get more CPU at the same priority if you can break the job up between multiple processes or threads. It's generally easier to do this with threads than with separate processes, but you can do pretty well with separate processes and shared memory for a lot of tasks -- particularly sequential independent calculations (often found inside loops). A simple shell script illustrates the principle: #! /bin/csh foreach i (/usr/*) find $i -name foo end versus: #! /bin/csh foreach i (/usr/*) find $i -name foo & end The latter will finish much faster (unless it thrashes the system), but it has at least one problem -- output will become intermingled unless you give each process its own output file. The same sorts of problems will have to be solved for a real application; see any operating systems book for lots of solutions. This method of parallelism is seen most often on multiprocessor machines since processes will tend to execute on separate processors and you get incredible throughput improvements. On the Encore Multimax this technique is used for grep and make, for instance. The technique still works on single processors -- obviously so since the whole idea behind multitasking is to fully utilize the CPU (amongst other resources), but usually not as well. |>It seems to me the answer is no because then every programmer would try this |>in his/her code and the system would halt. Yes, this technique will definitely hurt the system if you run too many parallel processes, but so will any technique that gives a single application more than its "share" of CPU. It's also a lot harder because you have to coordinate processes so many people won't bother unless they really need it or the system makes such a thing easy (I have yet to see a system where it was particularly easy to parallelize tasks effectively :-). jim frost software tool & die madd@std.com ----------------------------- From: Mitchell Wyle Subject: Re: Stupid awk question Date: 11 Oct 89 17:00:11 GMT To: info-unix@sem.brl.mil In article dmaustin@vivid.sun.com (Darren Austin) writes: >I am trying to split up a large output file into several >smaller files. The smaller files are named after the value in >the second field. I tried using the following simple awk script, > >(current == $2) {print > current".summary"} >(current != $2) {close(current".summary"); > current=$2;print > current".summary";} > >but it fails with > >awk: too many output files 10 Even though everyone will soon have new awk and all these old awk problems will go away, I think this question deserves to be in the "Frequently asked questions and answers" periodic postings. Who moderates it? How should one post to it? * * * To answer the question, I shall quote verbatum an old article. >>I am trying to use AWK to split one file into many formatted, smaller files. >>The problem I am having is that I cannot output to more than 10 files... > > Well, it won't help you right now, but the long-term fix is to complain > to your software supplier and ask them to get rid of the silly limit. > It's not that hard. The limits are based on the number of file descriptors that can be open at one time (usually small). One way that I often get around this is by writting something like this which splits up the input on the field $1 . sort +0 | awk ' { if (last != $1) { if (NR > 0) print "!XYZZY"; print "cat > " $1 "< 0) print "!XYZZY"; }' | /bin/sh Tony O'Hagan tonyo@qitfit.qitcs.oz * * * I use Tony's solution all the time. I have seen it used by at least two other people (David Goodenough and Amos Shapiro) in shell scripts posted to the net. It is very important to put that trailing End_of_Here_Document string in the END clause of your awk program! Depending on the complexity of your parse, you might need other cleanup code there as well. Happy hacking, -Mitchell F. Wyle Institut fuer Informationssysteme wyle@inf.ethz.ch ETH Zentrum / 8092 Zurich, Switzerland +41 1 256 5237 -- If this appears in _IN_MODERATION_ or ClariNet, please let me know. I am forbidden to tell you that you can reach me at: ...!uunet!mcvax!ethz!wyle or wyle@rascal.ics.utexas.edu ----------------------------- From: Marty Saletta Subject: Looking for the program "gone"... Date: 11 Oct 89 20:23:59 GMT To: info-unix@sem.brl.mil Yes, can some nice person in NetLand tell me where I can get a copy of the PD program gone? Gone is an alternative to "lock" that I used earlier this year from comp.sources.unix (or one of the other newsgroups.) Thanks in advance! -Marty -- / / |\ | / / | / ~Marty Saletta @ Fredonia,New York~~Leafs:3rd place~ / __ /__ | \| /__ / | / ~Atari ST,New York Yankees,Who,Pink Floyd,ELP,Fripp~ \ / \ | | \ \ | \ ~Toronto Maple Leafs,Yes,CZ-1,Mad Max,and hi Lorie!~ \/ \ | | \ / | / ~UUCP:...{decvax,rutgers}!sunybcs!fredonia!sale5312~ ----------------------------- From: Chris Gregory Subject: recommendations wanted Date: 11 Oct 89 20:47:14 GMT Followup-To: comp.dcom.lans Keywords: TCP/IP, ethernet, SCO Unix 3.2, vendors To: info-unix@sem.brl.mil A couple of questions: 1) Where can I get TCP/IP for SCO Unix 3.2? Surely someone out there is using it. I've been calling around, but can't seem to find a anyone that has it. 2) Where is a good place to get ethernet cards? I'd probably be able to find these, but I'd like some recommendations-comments-complaints about places others have dealt with. Thank you. Chris Gregory --o-- Ahlstrom Filtration, Inc. ---ooo--- (formerly Filtration Sciences Corp.) ==:::::== chris@tiamat.fsc.com =:::= ----------------------------- From: Paul Reger Subject: printf() with vector arguments. Date: 11 Oct 89 18:02:59 GMT Keywords: printf() To: info-unix@sem.brl.mil I was wondering if there exists such a beast as: void vec_printf(char *fmt,void *args[]); (as opposed to what we're all familiar with: void printf(char *fmt, ...);) Such a thing would be useful for a tool that can be used with any shell - call it shell_printf. This would have the synopsis: shell_printf fmt [arg1 [arg2 [arg3 ... [argn]]]] and its purpose would be to format and print out its arguments to stdout in the exact same manner as printf() does. Such a tool would be useful for output in shell scripts. For example: shell_printf "There are %9d dogs, weighing %9g pounds, and my son's name is '%s'.\n\n\n" 100 12.23 Eric which would print out to stdout: `` There are 100 dogs, weighing 12.23 punds, and my son's name is 'Eric'. '' Without the vec_printf() routine, such a tool would be hard to do. paulr (Paul Reger) Sequent Computer Systems, Beaverton Oregon {uunet,ucbvax!rutgers!ogccse}!sequent!paulr -- paulr (Paul Reger) Sequent Computer Systems, Beaverton Oregon {uunet,ucbvax!rutgers!ogccse}!sequent!paulr ----------------------------- From: David Robinson Subject: Re: Making a named pipe over NFS Date: 11 Oct 89 23:08:55 GMT Keywords: /etc/mknod, fifo, NFS, SunOS To: info-unix@sem.brl.mil In article <2388@munnari.oz.au> ok@cs.mu.oz.au (Richard O'Keefe) writes: Subject: SUN QUESTION: CDC Sabre 1.2 Gigabyte drives w/ Xylogics 753 ctrlr Date: 11 Oct 89 22:40:17 GMT Followup-To: poster To: info-unix@sem.brl.mil Has anyone in Sun-land hooked up CDC Sabre 1.2 Gigabyte drives to Sun 3/280s (with 753 or 7053 (aka SMD4 ctrlr) ctrlr) ? If so pleeeeeeeease mail me the format.dat entries for these drives. DIP switch info. will be appreciated too. I am going out of my mind trying to figure out whether Sun supports the CDC Sabre 1.2 Gbyte drive.... Thanks a Giga-load, Fmb -- NOTHING in the above article has the slightest relationship to reality. If any reality correspondences are found, please notify me IMMEDIATELY. Any threats, abuse or stupidity of any kind are purely UNINTENTIONAL. My employer does not know that I exist and is not responsible for anything. ----------------------------- From: "Barton A. Fisk" Subject: upper limit of NFILE and NINODE on 286? Date: 11 Oct 89 22:53:56 GMT Keywords: 286, sco, xenix To: info-unix@sem.brl.mil What, if any would be the upper limit that may be set for NFILE and NINODE in /usr/sys/conf/master for a 286? What determines this limit? What would be the most painless way of finding out if a value has taken effect for these variables? Many thanks in advance as usual. -- Barton A. Fisk | UUCP: {attctc,texbell,vector}!warble!holston!barton PO Box 1781 | (PSEUDO) DOMAIN: barton@holston.UUCP Lake Charles, La. 70602 | ---------------------------------------- 318-439-5984 | "Let him who is without sin cast the first stone"-JC ----------------------------- From: Lyndon Nerenberg Subject: Re: TcP/Ip Date: 11 Oct 89 23:00:22 GMT To: info-unix@sem.brl.mil In article <21092@adm.BRL.MIL> CSSNET%NUSDISCS.BITNET@cunyvm.cuny.edu writes: > Wollongong Integrated Networking WIN/3B: Release 2.1 > AT&T 10base5 Network Interface (NI) Package: Release 1.1 Release 2.1 contains a number of bugs -- enough to make it almost unuseable. About the only solution is to upgrade to WIN/TCP 3.0. You also need to do some heavy tuning of the kernel parameters. We run with the following parameters: master.d/tcp NTCP=64 master.d/ucp NUDP=128 You also need to crank up some of the streams stuff (TIMOD & TIRDWR) but I don't have the specific values handy. > We are running the above on our AT&T 3B4000/15 Pity. -- Lyndon Nerenberg VE6BBM / Computing Services / Athabasca University {alberta,decwrl,lsuc}!atha!lyndon || lyndon@cs.AthabascaU.CA "I think every man should have a wife. You can't blame everything on the government." -- Jed Clampett ----------------------------- From: Dave Thompson Subject: UNIX backup to unattended 8mm tape drive Date: 12 Oct 89 00:52:55 GMT Keywords: backup To: info-unix@sem.brl.mil We would like help finding a software package to do UNIX backups. We have an Ethernet LAN with a number of UNIX boxes, each with a hard disk. We have a DEC microVAX 2 with an 8mm 2.3 Gigabyte Exabyte tape backup system. We want to backup the UNIX boxes, one after another, onto one 8mm tape, unattended. Is there software out there that can do the job??? Thanks for any help or info that you have. Respond to: David Thompson at davet@iscuva.iscs.com -- David Thompson UUCP: davet@iscuva.ISCS.COM ISC-Bunker Ramo Corporation (uunet!iscuva!davet) East 22425 Appleway Phone: +1 509 927 5115 Liberty Lake, WA 99019 ----------------------------- From: 9704 Subject: Re: Stupid awk question Date: 12 Oct 89 02:07:49 GMT To: info-unix@sem.brl.mil In article <3731@ethz-inf.UUCP> wyle@ethz.UUCP (Mitchell Wyle) writes: > In article Darren Austin writes: > > >I am trying to split up a large output file into several > >smaller files. The smaller files are named after the value in > >the second field. I tried using the following simple awk script, > > [...] > >but it fails with > >awk: too many output files 10 > > [...] > sort +0 | awk '[SCRIPT BY TONY O'HAGAN DELETED]' | /bin/sh > [...] If you don't have access to the new AWK, but do have the "bs" command (mini-language) on your machine, I've found it also works well for splitting a file into subfiles which are named by a field of the input. The following bs program should solve Mr. Austin's problem in one process: #!/bin/bs # Split the input into files named by the 2nd field. outfile = "" while ?(line = get) match (line, "[^\t ]*[\t ]*\([^\t ]*\)") if mstring(1) != outfile open ("put", outfile=mstring(1), "w") put = line next run (The open seems to automatically close the previous file) I don't know how portable this is; bs is available in System V.2 anyway. Type ^N now for a way to do this in 1 line of PERL, by Mr. Schwartz... ;-) -- Greg Ubben bink@aplcen.apl.jhu.edu ...!uunet!mimsy!aplcen!bink ----------------------------- From: Donald McLachlan Subject: Re: Reversing a file? Date: 9 Oct 89 04:06:34 GMT To: info-unix@sem.brl.mil If you wnat to reverse the lines from right to left, try the command 'rev filename'. ----------------------------- From: Maarten Litmaath Subject: Vi Reference - version 6 Date: 5 Oct 89 06:28:23 GMT Expires: 2 Nov 92 05:00:00 GMT To: info-unix@sem.brl.mil It'll never end. Many Minor Modifications, some additions. A patch would be twice as big. Still `old' format (what happened to you, Kevin?). Enjoy. : This is a shar archive. Extract with sh, not csh. : This archive ends with exit, so do not worry about trailing junk. : --------------------------- cut here -------------------------- PATH=/bin:/usr/bin:/usr/ucb CTRL_L="`echo L | tr L '\14'`" echo Extracting 'vi.ref.6' sed -e 's/^X//' \ -e "s/^Control-L$/$CTRL_L/" > 'vi.ref.6' << '+ END-OF-FILE ''vi.ref.6' X X X X X X //////////////////////////////////////////////////////////////////////// X / VI REFERENCE (by maart@cs.vu.nl) / X //////////////////////////////////////////////////////////////////////// X X Warning: some vi versions don't support the more esoteric features X described in this document. You can edit/redistribute this document X freely, as long as you don't make false claims on original authorship. X X default values : 1 X ^X : x X [*] : `*' is optional X <*> : `*' must not be taken literally X : space X : carriage return X : linefeed X : horizontal tab X : escape X : your erase character X : your kill character X : your interrupt character X : an element in the range X N : number (`*' = allowed, `-' = not appropriate) X CHAR : char unequal to | X WORD : word followed by || XControl-L X X X X X X ///////////////// X / move commands / X ///////////////// X X N | Command | Meaning X ---+--------------------+----------------------------------------------- X * | h | ^H | | <*> chars to the left. X * | j | | ^N | <*> lines downward. X * | l | | <*> chars to the right. X * | k | ^P | <*> lines upward. X * | $ | To the end of line <*> from the cursor. X - | ^ | To the first CHAR of the line. X * | _ | To the first CHAR <*> - 1 lines lower. X * | - | To the first CHAR <*> lines higher. X * | + | | To the first CHAR <*> lines lower. X - | 0 | To the first char of the line. X * | | | To column <*> (: only to the endpoint). X * | f | <*> s to the right (find). X * | t | Till before <*> s to the right. X * | F | <*> s to the left. X * | T | Till after <*> s to the left. X * | ; | Repeat latest `f'|`t'|`F'|`T' <*> times. X * | , | Idem in opposite direction. X * | w | <*> words forward. X * | W | <*> WORDS forward. X * | b | <*> words backward. X * | B | <*> WORDS backward. X * | e | To the end of word <*> forward. X * | E | To the end of WORD <*> forward. X * | G | Go to line <*> (default EOF). X * | H | To line <*> from top of the screen (home). X * | L | To line <*> from bottom of the screen (last). X - | M | To the middle line of the screen. X * | ) | <*> sentences forward. X * | ( | <*> sentences backward. X * | } | <*> paragraphs forward. X * | { | <*> paragraphs backward. X - | ]] | To the next section (default EOF). X - | [[ | To the previous section (default begin of file). X - | ` | To the mark. X - | ' | To the first CHAR of the line with the mark. X - | `` | To the cursor position before the latest absolute X | jump (of which are examples `/' and `G'). X - | '' | To the first CHAR of the line on which the cursor X | was placed before the latest absolute jump. X - | / | To the next occurrence of . X - | ? | To the previous occurrence of . X - | n | Repeat latest `/'|`?' (next). X - | N | Idem in opposite direction. X - | % | Find the next bracket and go to its match X | (also with `{'|`}' and `['|`]'). XControl-L X X X X X X ///////////////////////// X / searching (see above) / X ///////////////////////// X X :ta | Search in the tags file where is X | defined (file, line), and go to it. X ^] | Use the name under the cursor in a `:ta' command. X :[x,y]g// | Search globally [from line x to y] for X | and execute the `ex' on each occurrence. X :[x,y]v// | Execute on the lines that don't match. X X /////////////////// X / undoing changes / X /////////////////// X X u | Undo the latest change. X U | Undo all changes on a line, while not having X | moved off it (unfortunately). X :q! | Quit vi without writing. X :e! | Re-edit a messed-up file. X X /////////////////////////////////// X / appending text (end with ) / X /////////////////////////////////// X X * | a | <*> times after the cursor. X * | A | <*> times at the end of line. X * | i | <*> times before the cursor (insert). X * | I | <*> times before the first CHAR of the line X * | o | On a new line below the current (open). X | The count is only useful on a slow terminal. X * | O | On a new line above the current. X | The count is only useful on a slow terminal. X * | > | Shift the lines described by <*> one X | shiftwidth to the right (layout!). X * | >> | Shift <*> lines one shiftwidth to the right. X * | ["]p | Put the contents of the (default undo) buffer X | <*> times after the cursor. X | A buffer containing lines is put only once, X | below the current line. X * | ["]P | Put the contents of the (default undo) buffer X | <*> times before the cursor. X | A buffer containing lines is put only once, X | above the current line. X * | . | Repeat previous command <*> times. X | If the last command before a `.' command X | references a numbered buffer, the buffer number X | is incremented first (and the count is ignored): X | X | "1pu.u.u.u.u - `walk through' buffers 1 X | through 5 X | "1P.... - restore them XControl-L X X X X X X ///////////////// X / deleting text / X ///////////////// X X Everything deleted can be stored into a buffer. This is achieved by X putting a `"' and a letter before the delete command. The X deleted text will be in the buffer with the used letter. If X is used as buffer name, the adjugate buffer will be augmented X instead of overwritten with the text. The undo buffer always X contains the latest change. Buffers <1-9> contain the latest 9 X LINE deletions (`"1' is most recent). X X * | x | Delete <*> chars under and after the cursor. X * | X | <*> chars before the cursor. X * | d | From begin to endpoint of <*>. X * | dd | <*> lines. X - | D | The rest of the line. X * | < | Shift the lines described by <*> one X | shiftwidth to the left (layout!). X * | << | Shift <*> lines one shiftwidth to the left. X * | . | Repeat latest command <*> times. X X ////////////////////////////////// X / changing text (end with ) / X ////////////////////////////////// X X * | r | Replace <*> chars by - no . X * | R | Overwrite the rest of the line, X | appending change <*> - 1 times. X * | s | Substitute <*> chars. X * | S | <*> lines. X * | c | Change from begin to endpoint of <*>. X * | cc | <*> lines. X * | C | The rest of the line and <*> - 1 next lines. X * | = | If the option `lisp' is set, this command X | will realign the lines described by <*> X | as though they had been typed with the option X | `ai' set too. X - | ~ | Switch lower and upper cases. X * | J | Join <*> lines (default 2). X * | . | Repeat latest command <*> times (`J' only once). X - | & | Repeat latest `ex' substitute command, e.g. X | `:s/wrong/good'. X - | :[x,y]s/

//| Substitute (on lines x through y) the pattern X |

(default the last pattern) with . Useful X | flags are `g' for `global' (i.e. change every X | non-overlapping occurrence of

) and `c' for X | `confirm' (type `y' to confirm a particular X | substitution, else ). Instead of `/' any X | punctuation CHAR unequal to can be used as X | delimiter. XControl-L X X X X X X /////////////////////////////////// X / substitute replacement patterns / X /////////////////////////////////// X X The basic meta-characters for the replacement pattern are `&' and `~'; X these are given as `\&' and `\~' when nomagic is set. Each instance X of `&' is replaced by the characters which the regular expression X matched. The meta-character `~' stands, in the replacement X pattern, for the defining text of the previous replacement X pattern. Other meta-sequences possible in the replacement pattern X are always introduced by the escaping character `\'. The sequence X `\n' (with `n' in [1-9]) is replaced by the text matched by the X n-th regular subexpression enclosed between `\(' and `\)'. The X sequences `\u' and `\l' cause the immediately following character X in the replacement to be converted to upper- or lower-case X respectively if this character is a letter. The sequences `\U' and X `\L' turn such conversion on, either until `\E' or `\e' is X encountered, or until the end of the replacement pattern. X X ////////////////////////////// X / remembering text (yanking) / X ////////////////////////////// X X With yank commands you can put `"' before the command, just as X with delete commands. Otherwise you only copy to the undo buffer. X The use of buffers is THE way of copying text to another X file; see the `:e ' command. X X * | y | Yank from begin to endpoint of <*>. X * | yy | <*> lines. X * | Y | Idem (should be equivalent to `y$' though). X - | m | Mark the cursor position with a letter. X X //////////////////////////////////////// X / commands while in append|change mode / X //////////////////////////////////////// X X ^@ | If typed as the first character of the X | insertion, it is replaced with the previous X | text inserted (max. 128 chars), after which X | the insertion is terminated. X ^V | Deprive the next char of its special meaning X | (e.g. ). X ^D | One shiftwidth to the left. X 0^D | Remove all indentation on the current line X | (there must be no other chars on the line). X ^^D | Idem, but it is restored on the next line. X ^T | one shiftwidth to the right X ^H | | One char back. X ^W | One word back. X | Back to the begin of the change on the X | current line. X | like . XControl-L X X X X X X ///////////////////////////////////////////////// X / writing, editing other files, and quitting vi / X ///////////////////////////////////////////////// X X In `:' `ex' commands `%' denotes the current file, `#' is a synonym for X the alternate file (which normally is the previous file). X Marks can be used for line numbers too: '. X In the `:w'|`:f'|`:cd'|`:e'|`:n' commands shell meta-characters can be X used. X X :q | Quit vi, unless the buffer has been changed. X :q! | Quit vi without writing. X ^Z | Suspend vi. X :w | Write the file. X :w | Write to the file . X :w >> | Append the buffer to the file . X :w! | Overwrite the file . X :x,y w | Write lines x through y to the file . X :wq | Write the file and quit vi; some versions quit X | even if the write was unsuccessful! X | Use `ZZ' instead. X ZZ | Write if the buffer has been changed, and X | quit vi. If you have invoked vi with the `-r' X | option, you'd better write the file X | explicitly (`w' or `w!'), or quit the X | editor explicitly (`q!') if you don't want X | to overwrite the file - some versions of vi X | don't handle the `recover' option very well. X :x [] | Idem [but write to ]. X :x! [] | `:w![]' and `:q'. X :pre | Preserve the file - the buffer is saved as if X | the system had just crashed; for emergencies, X | when a `:w' command has failed and you don't X | know how to save your work (see `vi -r'). X :f | Set the current filename to . X :cd [

] | Set the working directory to X | (default home directory). X :cd! [] | Idem, but don't save changes. X :e [+] | Edit another file without quitting vi - the X | buffers are not changed (except the undo X | buffer), so text can be copied from one file to X | another this way. [Execute the `ex' command X | (default `$') when t-- Did Andy Tanenbaum get his programming |Maarten Litmaath @ VU Amsterdam: instruction from a Cereal box? (Sam McCrea)|maart@cs.vu.nl, mcvax!botter!maart ----------------------------- From: Maarten Litmaath Subject: Dutch Vi Reference available Date: 5 Oct 89 06:40:08 GMT To: info-unix@sem.brl.mil Email if you're interested. -- Did Andy Tanenbaum get his programming |Maarten Litmaath @ VU Amsterdam: instruction from a Cereal box? (Sam McCrea)|maart@cs.vu.nl, mcvax!botter!maart ----------------------------- From: Maarten Litmaath Subject: Vi Reference - version 6 Date: 5 Oct 89 06:49:50 GMT Expires: 2 Nov 92 05:00:00 GMT To: info-unix@sem.brl.mil It'll never end. Many Minor Modifications, some additions. A patch would be twice as big. Still `old' format (what happened to you, Kevin?). Enjoy! : This is a shar archive. Extract with sh, not csh. : This archive ends with exit, so do not worry about trailing junk. : --------------------------- cut here -------------------------- PATH=/bin:/usr/bin:/usr/ucb CTRL_L="`echo L | tr L '\14'`" echo Extracting 'vi.ref.6' sed -e 's/^X//' \ -e "s/^Control-L$/$CTRL_L/" > 'vi.ref.6' << '+ END-OF-FILE ''vi.ref.6' X X X X X X //////////////////////////////////////////////////////////////////////// X / VI REFERENCE (by maart@cs.vu.nl) / X //////////////////////////////////////////////////////////////////////// X X Warning: some vi versions don't support the more esoteric features X described in this document. You can edit/redistribute this document X freely, as long as you don't make false claims on original authorship. X X default values : 1 X ^X : x X [*] : `*' is optional X <*> : `*' must not be taken literally X : space X : carriage return X : linefeed X : horizontal tab X : escape X : your erase character X : your kill character X : your interrupt character X : an element in the range X N : number (`*' = allowed, `-' = not appropriate) X CHAR : char unequal to | X WORD : word followed by || XControl-L X X X X X X ///////////////// X / move commands / X ///////////////// X X N | Command | Meaning X ---+--------------------+----------------------------------------------- X * | h | ^H | | <*> chars to the left. X * | j | | ^N | <*> lines downward. X * | l | | <*> chars to the right. X * | k | ^P | <*> lines upward. X * | $ | To the end of line <*> from the cursor. X - | ^ | To the first CHAR of the line. X * | _ | To the first CHAR <*> - 1 lines lower. X * | - | To the first CHAR <*> lines higher. X * | + | | To the first CHAR <*> lines lower. X - | 0 | To the first char of the line. X * | | | To column <*> (: only to the endpoint). X * | f | <*> s to the right (find). X * | t | Till before <*> s to the right. X * | F | <*> s to the left. X * | T | Till after <*> s to the left. X * | ; | Repeat latest `f'|`t'|`F'|`T' <*> times. X * | , | Idem in opposite direction. X * | w | <*> words forward. X * | W | <*> WORDS forward. X * | b | <*> words backward. X * | B | <*> WORDS backward. X * | e | To the end of word <*> forward. X * | E | To the end of WORD <*> forward. X * | G | Go to line <*> (default EOF). X * | H | To line <*> from top of the screen (home). X * | L | To line <*> from bottom of the screen (last). X - | M | To the middle line of the screen. X * | ) | <*> sentences forward. X * | ( | <*> sentences backward. X * | } | <*> paragraphs forward. X * | { | <*> paragraphs backward. X - | ]] | To the next section (default EOF). X - | [[ | To the previous section (default begin of file). X - | ` | To the mark. X - | ' | To the first CHAR of the line with the mark. X - | `` | To the cursor position before the latest absolute X | jump (of which are examples `/' and `G'). X - | '' | To the first CHAR of the line on which the cursor X | was placed before the latest absolute jump. X - | / | To the next occurrence of . X - | ? | To the previous occurrence of . X - | n | Repeat latest `/'|`?' (next). X - | N | Idem in opposite direction. X - | % | Find the next bracket and go to its match X | (also with `{'|`}' and `['|`]'). XControl-L X X X X X X ///////////////////////// X / searching (see above) / X ///////////////////////// X X :ta | Search in the tags file where is X | defined (file, line), and go to it. X ^] | Use the name under the cursor in a `:ta' command. X :[x,y]g// | Search globally [from line x to y] for X | and execute the `ex' on each occurrence. X :[x,y]v// | Execute on the lines that don't match. X X /////////////////// X / undoing changes / X /////////////////// X X u | Undo the latest change. X U | Undo all changes on a line, while not having X | moved off it (unfortunately). X :q! | Quit vi without writing. X :e! | Re-edit a messed-up file. X X /////////////////////////////////// X / appending text (end with ) / X /////////////////////////////////// X X * | a | <*> times after the cursor. X * | A | <*> times at the end of line. X * | i | <*> times before the cursor (insert). X * | I | <*> times before the first CHAR of the line X * | o | On a new line below the current (open). X | The count is only useful on a slow terminal. X * | O | On a new line above the current. X | The count is only useful on a slow terminal. X * | > | Shift the lines described by <*> one X | shiftwidth to the right (layout!). X * | >> | Shift <*> lines one shiftwidth to the right. X * | ["]p | Put the contents of the (default undo) buffer X | <*> times after the cursor. X | A buffer containing lines is put only once, X | below the current line. X * | ["]P | Put the contents of the (default undo) buffer X | <*> times before the cursor. X | A buffer containing lines is put only once, X | above the current line. X * | . | Repeat previous command <*> times. X | If the last command before a `.' command X | references a numbered buffer, the buffer number X | is incremented first (and the count is ignored): X | X | "1pu.u.u.u.u - `walk through' buffers 1 X | through 5 X | "1P.... - restore them XControl-L X X X X X X ///////////////// X / deleting text / X ///////////////// X X Everything deleted can be stored into a buffer. This is achieved by X putting a `"' and a letter before the delete command. The X deleted text will be in the buffer with the used letter. If X is used as buffer name, the adjugate buffer will be augmented X instead of overwritten with the text. The undo buffer always X contains the latest change. Buffers <1-9> contain the latest 9 X LINE deletions (`"1' is most recent). X X * | x | Delete <*> chars under and after the cursor. X * | X | <*> chars before the cursor. X * | d | From begin to endpoint of <*>. X * | dd | <*> lines. X - | D | The rest of the line. X * | < | Shift the lines described by <*> one X | shiftwidth to the left (layout!). X * | << | Shift <*> lines one shiftwidth to the left. X * | . | Repeat latest command <*> times. X X ////////////////////////////////// X / changing text (end with ) / X ////////////////////////////////// X X * | r | Replace <*> chars by - no . X * | R | Overwrite the rest of the line, X | appending change <*> - 1 times. X * | s | Substitute <*> chars. X * | S | <*> lines. X * | c | Change from begin to endpoint of <*>. X * | cc | <*> lines. X * | C | The rest of the line and <*> - 1 next lines. X * | = | If the option `lisp' is set, this command X | will realign the lines described by <*> X | as though they had been typed with the option X | `ai' set too. X - | ~ | Switch lower and upper cases. X * | J | Join <*> lines (default 2). X * | . | Repeat latest command <*> times (`J' only once). X - | & | Repeat latest `ex' substitute command, e.g. X | `:s/wrong/good'. X - | :[x,y]s/

//| Substitute (on lines x through y) the pattern X |

(default the last pattern) with . Useful X | flags are `g' for `global' (i.e. change every X | non-overlapping occurrence of

) and `c' for X | `confirm' (type `y' to confirm a particular X | substitution, else ). Instead of `/' any X | punctuation CHAR unequal to can be used as X | delimiter. XControl-L X X X X X X /////////////////////////////////// X / substitute replacement patterns / X /////////////////////////////////// X X The basic meta-characters for the replacement pattern are `&' and `~'; X these are given as `\&' and `\~' when nomagic is set. Each instance X of `&' is replaced by the characters which the regular expression X matched. The meta-character `~' stands, in the replacement X pattern, for the defining text of the previous replacement X pattern. Other meta-sequences possible in the replacement pattern X are always introduced by the escaping character `\'. The sequence X `\n' (with `n' in [1-9]) is replaced by the text matched by the X n-th regular subexpression enclosed between `\(' and `\)'. The X sequences `\u' and `\l' cause the immediately following character X in the replacement to be converted to upper- or lower-case X respectively if this character is a letter. The sequences `\U' and X `\L' turn such conversion on, either until `\E' or `\e' is X encountered, or until the end of the replacement pattern. X X ////////////////////////////// X / remembering text (yanking) / X ////////////////////////////// X X With yank commands you can put `"' before the command, just as X with delete commands. Otherwise you only copy to the undo buffer. X The use of buffers is THE way of copying text to another X file; see the `:e ' command. X X * | y | Yank from begin to endpoint of <*>. X * | yy | <*> lines. X * | Y | Idem (should be equivalent to `y$' though). X - | m | Mark the cursor position with a letter. X X //////////////////////////////////////// X / commands while in append|change mode / X //////////////////////////////////////// X X ^@ | If typed as the first character of the X | insertion, it is replaced with the previous X | text inserted (max. 128 chars), after which X | the insertion is terminated. X ^V | Deprive the next char of its special meaning X | (e.g. ). X ^D | One shiftwidth to the left. X 0^D | Remove all indentation on the current line X | (there must be no other chars on the line). X ^^D | Idem, but it is restored on the next line. X ^T | one shiftwidth to the right X ^H | | One char back. X ^W | One word back. X | Back to the begin of the change on the X | current line. X | like . XControl-L X X X X X X ///////////////////////////////////////////////// X / writing, editing other files, and quitting vi / X ///////////////////////////////////////////////// X X In `:' `ex' commands `%' denotes the current file, `#' is a synonym for X the alternate file (which normally is the previous file). X Marks can be used for line numbers too: '. X In the `:w'|`:f'|`:cd'|`:e'|`:n' commands shell meta-characters can be X used. X X :q | Quit vi, unless the buffer has been changed. X :q! | Quit vi without writing. X ^Z | Suspend vi. X :w | Write the file. X :w | Write to the file . X :w >> | Append the buffer to the file . X :w! | Overwrite the file . X :x,y w | Write lines x through y to the file . X :wq | Write the file and quit vi; some versions quit X | even if the write was unsuccessful! X | Use `ZZ' instead. X ZZ | Write if the buffer has been changed, and X | quit vi. If you have invoked vi with the `-r' X | option, you'd better write the file X | explicitly (`w' or `w!'), or quit the X | editor explicitly (`q!') if you don't want X | to overwrite the file - some versions of vi X | don't handle the `recover' option very well. X :x [] | Idem [but write to ]. X :x! [] | `:w![]' and `:q'. X :pre | Preserve the file - the buffer is saved as if X | the system had just crashed; for emergencies, X | when a `:w' command has failed and you don't X | know how to save your work (see `vi -r'). X :f | Set the current filename to . X :cd [

] | Set the working directory to X | (default home directory). X :cd! [] | Idem, but don't save changes. X :e [+] | Edit another file without quitting vi - the X | buffers are not changed (except the undo X | buffer), so text can be copied from one file to X | another this way. [Execute the `ex' command X | (default `$') when the new file has been X | read into the buffer.] must contain no X | or . See `vi startup'. X :e! [+] | Idem, without writing the current buffer. X ^^ | Edit the alternate (normally the previous) file. X :rew | Rewind the argument list, edit the first file. X :rew! | Idem, without writing the current buffer. X :n [+] [] | Edit next file or specify a new argument list. X :n! [+] [] | Idem, without writing the current buffer. X :args | Give the argument list, with the current file X | between `[' and `]'. XControl-L X X X X X X //////////////////// X / display commands / X //////////////////// X X ^G | Give file name, status, current line number X | and relative position. X ^L | Refresh the screen (sometimes `^P' or `^R'). X ^R | Sometimes vi replaces a deleted line by a `@', X | to be deleted by `^R' (see option `redraw'). X [*]^E | Expose <*> more lines at bottom, cursor X | stays put (if possible). X [*]^Y | Expose <*> more lines at top, cursor X | stays put (if possible). X [*]^D | Scroll <*> lines downward X | (default the number of the previous scroll; X | initialization: half a page). X [*]^U | Scroll <*> lines upward X | (default the number of the previous scroll; X | initialization: half a page). X [*]^F | <*> pages forward. X [*]^B | <*> pages backward (in older versions `^B' only X | works without count). X X If in the next commands the field is present, the windowsize X will change to . The window will always be displayed at the X bottom of the screen. X X [*]z[wi] | Put line <*> at the top of the window X | (default the current line). X [*]z[wi]+ | Put line <*> at the top of the window X | (default the first line of the next page). X [*]z[wi]- | Put line <*> at the bottom of the window X | (default the current line). X [*]z[wi]. | Put line <*> in the centre of the window X | (default the current line). XControl-L X X X X X X //////////////////////////// X / mapping and abbreviation / X //////////////////////////// X X When mapping take a look at the options `to' and `remap' (below). X X :map | is interpreted as , e.g. X | `:map ^C :!cc %^V' to compile from within vi X | (vi replaces `%' with the current file name). X :map | Show all mappings. X :unmap | Deprive of its mapping. When vi X | complains about non-mapped macros (whereas no X | typos have been made), first do something like X | `:map Z', followed by `:unmap ' X | (`Z' must not be a macro itself), or switch to X | `ex' mode first with `Q'. X :map! | Mapping in append mode, e.g. X | `:map! \be begin^Vend;^VO'. X | When is preceded by `^V', no X | mapping is done. X :map! | Show all append mode mappings. X :unmap! | Deprive of its mapping (see `:unmap'). X :ab | Whenever in append mode is preceded and X | followed by a breakpoint (e.g. or `,'), it X | is interpreted as , e.g. `:ab p procedure'. X | A `^V' immediately following inhibits X | expansion. X :ab | Show all abbreviations. X :unab | Do not consider an abbreviation X | anymore (see `:unmap'). X @ | Consider the contents of the named register a X | command, e.g.: X | o0^D:s/wrong/good/"zdd X | Explanation: X | o - open a new line X | 0^D - remove indentation X | :s/wrong/good/ - this input text is an X | `ex' substitute command X | - finish the input X | "zdd - delete the line just X | created into register `z' X | Now you can type `@z' to substitute `wrong' X | with `good' on the current line. X @@ | Repeat last register command. XControl-L X X X X X X ///////////////////////////// X / switch and shell commands / X ///////////////////////////// X X Q | ^\ | | Switch from vi to `ex'. X : | An `ex' command can be given. X :vi | Switch from `ex' to vi. X :sh | Execute a subshell, back to vi by `^D'. X :[x,y]! | Execute a shell [on lines x through y; X | these lines will serve as input for and X | will be replaced by its standard output]. X :[x,y]!! [] | Repeat last shell command [and append ]. X :[x,y]! ! [] | Use the previous command (the second `!') in a X | new command. X [*]! | The shell executes , with as standard X | input the lines described by <*>, X | next the standard output replaces those lines X | (think of `cb', `sort', `nroff', etc.). X [*]!! | Append to the last and execute it, X | using the lines described by the current X | <*>. X [*]!! | Give <*> lines as standard input to the X | shell , next let the standard output X | replace those lines. X [*]!!! [] | Use the previous [and append to it]. X :x,y w ! | Let lines x to y be standard input for X | (notice the between `w' and `!'). X :r! | Put the output of onto a new line. X :r | Read the file into the buffer. XControl-L X X X X X X ////////////// X / vi startup / X ////////////// X X vi [] | Edit the files, start with the first page of X | the first file. X X The editor can be initialized by the shell variable `EXINIT', which X looks like: X X EXINIT='||...' X : set options X map ... X ab ... X export EXINIT (in the Bourne shell) X X However, the list of initializations can also be put into a file. X If this file is located in your home directory, and is named `.exrc' X AND the variable `EXINIT' is NOT set, the list will be executed X automatically at startup time. However, vi will always execute the X contents of a `.exrc' in the current directory, if you own the file. X Else you have to give the execute command yourself: X X :source file X or X :so file X X On-line initializations can be given with `vi + file', e.g.: X X vi +x file | The cursor will immediately jump to line x X | (default last line). X vi +/ file | ~ to the first occurrence of . X X You can start at a particular tag with: X X vi -t | Start in the right file in the right place. X X Sometimes (e.g. if the system crashed while you were editing) it is X possible to recover files lost in the editor by `vi -r file'. If X you just want to view a file by using vi, and you want to avoid any X change, instead of vi you can use the `view' or `vi -R' command: X the option `readonly' will be set automatically (with `:w!' you can X override this option). XControl-L X X X X X X ////////////////////////////// X / the most important options / X ////////////////////////////// X X ai | autoindent - In append mode after a the X | cursor will move directly below the first X | CHAR on the previous line. However, if the X | option `lisp' is set, the cursor will align X | at the first argument to the last open list. X aw | autowrite - Write at every shell escape. X | (useful when compiling from within vi) X dir= | directory - The directory for vi to make X | temporary files (default `/tmp'). X eb | errorbells - Beeps when you goof X | (not on every terminal). X ic | ignorecase - No distinction between upper and X | lower cases when searching. X lisp | Redefine the following commands: X | `(', `)' - move backward (forward) over X | S-expressions X | `{', `}' - idem, but don't stop at atoms X | `[[', `]]' - go to previous (next) line X | beginning with a `(' X | See option `ai'. X list | is shown as `$', as `^I'. X magic | If this option is set (default), the chars `.', X | `[' and `*' have special meanings within search X | and `ex' substitute commands. To deprive such a X | char of its special function it must be preceded X | by a `\'. If the option is turned off it's just X | the other way around. Meta-chars: X | ^ - must begin the line X | $ - must end the line X | . - matches any char X | [a-z] - matches any char in the range X | [] - matches any char in X | [^] - matches any char not in X | * - 0 or more s X | \<\> - must be a word X nu | number - Numbers before the lines. X para= | paragraphs - Every pair of chars in is X | considered a paragraph delimiter nroff macro X | (for `{' and `}'). A preceded by a `\' X | indicates the previous char is a single letter X | macro. `:set para=P\ bp' introduces `.P' and X | `.bp' as paragraph delimiters. Empty lines and X | section boundaries are paragraph boundaries too. X redraw | The screen remains up to date. X remap | If on (default), macros are repeatedly X | expanded until they are unchanged. X | Example: if `o' is mapped to `A', and `A' X | is mapped to `I', then `o' will map to `I' X | if `remap' is set, else it will map to `A'. X report=<*> | Vi reports whenever e.g. a delete X | or yank command affects <*> or more lines. X ro | readonly - The file is not to be changed. X | However, `:w!' will override this option. XControl-L X X X X X X sect= | sections - Gives the section delimiters (for `[[' X | and `]]'); see option `para'. A `{' beginning a X | line also starts a section (as in C functions). X sh= | shell - The program to be used for shell escapes X | (default `$SHELL' (default `/bin/sh')). X sw=<*> | shiftwidth - Gives the shiftwidth (default 8 X | positions). X sm | showmatch - Whenever you append a `)', vi shows X | its match if it's on the same page; also with X | `{' and `}'. If there's no match, vi will beep. X terse | Short error messages. X to | timeout - If this option is set, append mode X | mappings will be interpreted only if they're X | typed fast enough. X ts=<*> | tabstop - The length of a ; warning: this is X | only IN the editor, outside of it s have X | their normal length (default 8 positions). X wa | writeany - No checks when writing (dangerous). X warn | Warn you when you try to quit without writing. X wi=<*> | window - The default number of lines vi shows. X wm=<*> | wrapmargin - In append mode vi automatically X | puts a whenever there is a or X | within columns from the right margin. X ws | wrapscan - When searching, the end is X | considered `stuck' to the begin of the file. X X :set