Path: utzoo!attcan!uunet!cs.utexas.edu!csd4.milw.wisc.edu!bbn!oliveb!mipos3!omepd!merlyn
From: merlyn@iwarp.intel.com (Randal Schwartz)
Newsgroups: news.newusers.questions
Subject: moving ! lines to end of .newsrc (was Re: editing .newsrc)
Summary: using vi instead of Emacs
Message-ID: <4786@omepd.UUCP>
Date: 10 Aug 89 14:51:34 GMT
References: <354@wet.UUCP> <2354@bingvaxu.cc.binghamton.edu> <1736@frog.UUCP> <56990@tut.cis.ohio-state.edu>
Sender: news@omepd.UUCP
Reply-To: merlyn@iwarp.intel.com (Randal Schwartz)
Organization: Stonehenge; netaccess via Intel, Hillsboro, Oregon, USA
Lines: 42
In-reply-to: lum@armadillo.cis.ohio-state.edu (Lum Johnson)

In article <56990@tut.cis.ohio-state.edu>, lum@armadillo (Lum Johnson) writes:
| My .newsrc file is sorted into two different sections:  subscribed
| groups in order of the last article number in each so I can scan
| groups with low traffic and new groups early and groups with heavy
| traffic later;  and unsubscribed groups in alphabetical order, with
| numbers compressed to `1-n' to save space and time.
| 
| The latter effect is achieved with a simple (GNU Emacs) keyboard macro:
| 
| 	M-< C-s !		;; Find first exclamation mark
| 	C-x (			;; Begin keyboard macro
| 	    C-s ,		;; Find first comma
| 	    C-e M-b C-@		;; Set mark before last number on line
| 	    C-r ! Space 1 -	;; Find `! 1-' earlier on line
| 	    C-s			;; Move to end of `! 1-' field
| 	    C-w			;; Remove text from point to mark
| 	C-x )			;; End keyboard macro
| 	C-u C-u C-u C-x e	;; Execute macro 64 times
| 				;;  or until no more commas
| 
| (Note well that `C-w' immediately after `C-x h' kills the entire
| contents of the buffer, so it should be used with reasonable caution;
| `C-w' and `C-y' are inverse operations - they will undo each other.)

For vi users, to move the '!' lines to the end of the buffer
in any-ol' order, do:

:g/!/m$

(that's eight keystrokes...)  To "forget" skipped-over articles in
unsubscribed groups, do:

:g/! 1-.*[^0-9]\([0-9]*\)$/s//! 1-\1/p

(be sure "magic mode" is not turned off...)

Equal time for vi users... :-)
-- 
/== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\
| on contract to Intel, Hillsboro, Oregon, USA                           |
| merlyn@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn	         |
\== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/