Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/3/84; site sesame.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!talcott!sesame!paul From: paul@sesame.UUCP (Paul Ruel) Newsgroups: net.sources Subject: Re: Printing a file backwards Message-ID: <348@sesame.UUCP> Date: Tue, 8-Oct-85 02:59:00 EDT Article-I.D.: sesame.348 Posted: Tue Oct 8 02:59:00 1985 Date-Received: Sat, 12-Oct-85 15:41:21 EDT References: <1213@hpda.UUCP> Distribution: net Organization: Free-Access Unix in Boston Lines: 28 My feed's been unreliable recently, so I hope I'm not too untimely wih this followup...In keeping with the UN*X philosophy of using big complicated tools to solve small, inconsequential problems (:->), I suggest that you do the following to reverse lines in a file: 1) Edit the file using `vi'; 2) `O'pen a line and type the following: :1m'a^[-ma Note that the `^[' means an ESCape; 3) Delete this line into macro `a' by typing `"add' when positioned on the just created line (the `' are NOT typed); 4) Move your cursor to some line in the file and mark that line as line `a' by typing `ma'; 5) Type `@a' and *poof* all the lines in the file (above the marked line) will be reversed! The reversing process is terminated with a message from `vi' which reads: Move to a moved line which, despite its appearance, _means_: `The reversing is done'. By the way, this works on my 3b2/300 `vi', I hope it works on yours. `vi' macro experimentation is a _lot_ safer than playing `hack' on your employer's dime. Yes, you _can_ get `vi' stuck in loops, etc. I've got a number of visual display time wasters written in `vi' macros.