[news.newusers.questions] moving ! lines to end of .newsrc

merlyn@iwarp.intel.com (Randal Schwartz) (08/10/89)

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$<CR>

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

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

(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!" ==/