From owner-freebsd-newbies Wed Dec 16 09:34:13 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA15381 for freebsd-newbies-outgoing; Wed, 16 Dec 1998 09:34:13 -0800 (PST) (envelope-from owner-freebsd-newbies@FreeBSD.ORG) Received: from pau-amma.whistle.com (s205m64.whistle.com [207.76.205.64]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA15221 for ; Wed, 16 Dec 1998 09:34:06 -0800 (PST) (envelope-from dhw@whistle.com) Received: (from dhw@localhost) by pau-amma.whistle.com (8.9.1/8.9.1) id JAA14342; Wed, 16 Dec 1998 09:32:46 -0800 (PST) (envelope-from dhw) Date: Wed, 16 Dec 1998 09:32:46 -0800 (PST) From: David Wolfskill Message-Id: <199812161732.JAA14342@pau-amma.whistle.com> To: mlduke@concentric.net, newbies@FreeBSD.ORG Subject: Re: vi In-Reply-To: Sender: owner-freebsd-newbies@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Date: Tue, 15 Dec 1998 19:24:06 -0700 (MST) >From: ML Duke >... >Enter vi. Using the "de" command=delete to end of word, the garbage >preceeding the good text vanished very quickly, then "dd" quickly >eliminated the garbage following the good text. If you start doing more things with vi, I expect you will be positively impressed with some of the things it can do. Some of them are even useful :-) [as opposed, for example, to using vi macros to generate & solve mazes in the edit buffer -- which I heard that someone did...]. One example of a general approach that, combined with the tendency in UNIX systems to have fairly special-purpose, small(ish) programs that do a small number of things, mostly by reading "standard input" and writing "standard output" (i.e., "filters"): The cursor-movement commands may be used, in combination with "!", to select (part of) the edit buffer as "standard input" for an arbitrary pipeline of commands; the "standard output" of that pipeline will replace the selected part of the edit buffer. Thus, to sort a file that you're editing: 1G!Gsort does the trick. But if you just want to sort a handful of (non-blank) lines, and you can arrange for an empty line above and below the lines in question, position the cursor at the first line and try: !}sort to sort just those lines. Of course, these could be rather more elaborate.... david -- David Wolfskill UNIX System Administrator dhw@whistle.com voice: (650) 577-7158 pager: (650) 371-4621 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-newbies" in the body of the message