From: roten@CUBA.gsfc.nasa.gov (Charles Roten)
Subject: Re: How to Kill articles by name of sender ?
Organization: /cuba_b/dirbe/roten/.organization
X-Newsreader: GNU Emacs 18.57.1, GNUS 3.13, NNTP 3.10
Date: Wed, 9 Sep 1992 20:10:32 GMT

In article <1992Sep8.163737.20235@doug.cae.wisc.edu> yidao@cae.wisc.edu 
(Yidao Cai) writes:

>Hi, Every:
	   Sometimes I just don't want to read articles posted by a particular
>netter because he/she made too much noise/posted too many articles in a short
>time so that I have no time to follow, is there a way to kill these articles
>BY THE NAME OF THE SENDER ?
>	   Thanks in advance. 

It does seem to me that the level of ill feeling, not to mention 
geopolitical cluelessness, has risen sharply in this group recently.  So 
it seems to be the time for a repost of (ta da!) my 'rn' + 'gnus' 
KILL file summary.  

=============== Begin 'rn' + 'gnus' KILL file summary ===============
                         KILL file summary, V4.0

First, I'll summarize what I know about 'rn' KILL files, then 'gnus' KILL
files.  BTW, for those KILL file gurus out there who will get to the last
line and (reasonably) grumble .. '*My* newsreader's syntax is not here',
or '*&%$#! .. I did not learn anything I did not already know, and I know
stuff this guy does not' .. *please* fill me in, preferably with the kind
of information density I have used here.  I would like to include your
info in the next generation of this post .. giving you the credit due you,
of course.  A kinder, gentler Usenet News is up to us!

------------------------------ rn KILL files ------------------------------

Folks, here is a summary of the format for an 'rn' KILL file, with
user ID's, hosts, and groups changed to protect the guilty.

    First, a question .. do you type 'rn' to read news?  If so, then this
stuff has great relevance for you.  Otherwise, all bets are off.

    In the interests of not subjecting you to information overload, this
message is a summary which (hopefully) will make the KILL file semantics
clearer, using one of my killfiles as the example.  A generic killfile
entry looks like this ..

/[patterns to look for]/[*where* to look and what actions to take]

The format of the [patterns to look for] part is that of the Unix  'regexp',
the so-called 'regular expression'.  This can contain special interior
characters which match repetitions of the same character or wildcards of
length 1 or length arbitrary.  Special interior characters can also be used
to set up *alternate* patterns to look for.  A *GOOD* short explanation of
'regexps' can be found in Chapter 3 of 'Sed & Awk' by Dale Dougherty
(O'Reilly & Associates, Inc., November, 1990, ISBN 0-937175-59-5).  Sed and
awk are pair of Unix tools which use 'regexps' a *lot*.  Note also that
unless you otherwise specify, the [patterns to look for] part is case
*insensitive*.  This is differs from what Dougherty says .. there does not
seem to be an 'industry standard' form for regexps.  :-(  I've found other
differences as well.  :-(  Hence, if you try out any really sophisticated
regexp-based killfiles, it is safer IMHO to test your syntax in a killfile
for a high volume group you think is almost entirely noise.  I use
rec.arts.tv as a regexp testbed myself. :-)

One thing should be noted .. I have merged changes in 'rn' KILL file 
syntax suggested by the recent FAQ posting about 'rn' KILL files found in 
the news.newusers.questions group.  The basic change is that a '.' in a 
ID or site name should be replaced with a '\.' in the KILL file entry.  I 
must warn you, I have not been able to test this.  My system acts really 
crazy when I use 'rn' after having built my .newsrc using 'gnus'.  

The format of the [*where* to look and what actions to take] part is
characters separated by colons.

Now for the example.  Note how the location of the KILL file matches the
name of the group.

The (fictional) assumed group is   talk.politics.flamewars.
The KILL file is located in ~/News/talk/politics/flamewars/KILL, by default.

     -------------------- Uncommented Example --------------------
/^From: bogusman@turkey\.clueless\.edu/h:=:j
/^From: loser@tengallon\.bitnet\|^From: lostit@dribble\.UUCP/h:=:j
/^From: crazy@*cs\.looneybin\.edu/h:=:j
/^From: flamer@cray\.system5\.com\|^From: fanatic@vaxn\.bsd\.variant\.edu/h:=:j
/^From: hero@merlin\.wizard\.edu/h:M:=:shero
/misc\.headlines\|alt\.conspiracy/h:=:j
/alt\.alien\.visitors/a:=:j
/test/=:j
     -------------------- Commented Example --------------------

start                                 end
of                                    of
pattern                               pattern
|                                     |
|      ID of a net.nut whose          |
|      insanity is making *me*        |
|      crazy!  I don't want to        |
|      read his stuff!!               |
|      \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ |
/^From: bogusman@turkey\.clueless\.edu/h:=:j
 | \\\\\                               |||||
 | Search                              Generic code I use to
 | 'From:'                             junk a post based on
 | line                                header info *other*
 | only.                               than the 'Subject:'
 |                                     line.  This is
Initial ^ matches the beginning        explained below.
of a line.  This anchors the
'From:' to the line's beginning
in the search.


            A logical 'or' .. *both* ID's will be
            searched for.  Two get junked for the
            time-price of one!  The manual says
            this works for up to ten alternatives.
                               ||
/^From: loser@tengallon\.bitnet\|^From: lostit@dribble\.UUCP/h:=:j


        A wildcard that matches any character,
        string, or the null character.
              |
/^From: crazy@*cs\.looneybin\.edu/h:=:j
        |||||||||||||||||||||||||
        This maniac posts from 5 different machines!  The ID's are
        crazy@cs.looneybin.edu, crazy@sys1.cs.looneybin.edu,
        crazy@sys2.cs.looneybin.edu, crazy@sys3.cs.looneybin.edu, and
        crazy@sys4.cs.looneybin.edu.

        But I only see the first 2 posts.  From rn, I save the first
        post in ~/News/junk by 'sjunk' (so I can lift off his ID without
        making a typing error).  Then 'control-k' fires up emacs,
        editing my KILL file.  Once the new entry is in and the file
        saved, I type '!rm junk' from the 'rn' prompt to blast the junk
        file.
        When I see the second, I modify the entry, placing the '*' where
        you see it.  The '*' is a wildcard that matches any character or
        string.  I suppose '/^From: crazy@/h:=:j' would do as well, but
        there may be someone *else* with that ID who is sane.


                                                                        Print
                                                                       	number
                                                                        and
                                                                        title
          A net.malefactor's ID.        fanatic's posts also bite       before
          Gotcha, flamer!               the dust.                       junking
        |||||||||||||||||||||||||        \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\    |
/^From: flamer@cray\.system5\.com\|^From: fanatic@vaxn\.bsd\.variant\.edu/h:=:j
  \\\\\\                                                             ____/   /
   \\\\\\                    				     Search / 	    /
   This makes sure that only the                             all the  	   /
   'From: 'line of the header is                             header   Send to
   searched.                    				      bitbucket

Note that since the numbers of the junked posts are printed, we *do* have the
option of *choosing* to read one of the junked posts.  We just jot the post
number down as '=' flashes it on the screen, then type the post number in.


        Now *here* we have a net.horse of an different color!
        The posts of this redoubtable net.benefactor have been
        rumored to cause the deaf to hear, and upon being read,
        to cause the blind to see!  I know for a *fact* they
        make my day whenever I have the inexpressable pleasure
        of reading one!  Always gentle and polite, often funny
        usually displaying worldclass scholarship .. they are
        a river of net.gold in the darkness!  We want to both
        save these to a file ~/News/hero, and then reread them
        in the usual course of our perusal of this group.
        ||||||||||||||||||||||||
/^From: hero@merlin\.wizard\.edu/h:M:=:shero
                                   | |  \\\\\
                                   | |   Save this sucker!
                                   |  \
                                   |   Inform us of the happy event.
                                   |
                            Mark as unread.


/^Newsgroups:.*[ ,]misc\.headlines\|alt\.conspiracy/h:=:j
                   |||||||||||||||  |||||||||||||||
 same format as before, but search for the names of *newsgroups*.
 We junk the article if it's a *crosspost* to/from these groups,
 since their names *will* show up in the 'Newsgroups:' line of 
 header.  Then our entry bags the post!


/alt\.alien\.visitors/a:=:j
                      |
    This searches the *whole* *post*, instead of just the header, as with
    '/h:=:j', and then junks it after printing the 'Subject:' line if the
    group alt.alien.visitors is *mentioned* *anywhere* in it.


/test/=:j
      |||
    Here's how you can *nuke* those pesky 'test' posts!
    This is a *subject* we want to trash, so we don't need the 'h:',
    since 'rn' only looks in the 'Subject: ' line by default.  Pressing
    the 'K' key on a noxious thread has the same effect.  Edit the KILL
    file frequently if you do that often, to shorten the file, using the
    \| logical or to contract several lines into one.  Long KILL files
    are *SLOW*.  Back when I read the group, my alt.desert-storm KILL
    file took *forever* to finish (too many net.nuts and generic
    conspiracy theorists used it as a soap box).

     -------------------- End Example --------------------

    One last issue .. suppose you would prefer not to use your system's
default editor .. which is probably (yuck) vi.  Suppose you like emacs
(hooray) better.  The following is an excerpt from a recent
news.newusers.questions response.

     -------------------- begin excerpt --------------------

  1) Read the man page for nn and look up how to set environment variables in
the nn configuration files.

  2) If you're using csh or tcsh, put "setenv EDITOR emacs" and "setenv VISUAL
emacs" in your .login file.

  3) If you're using sh, bash, etc., put "EDITOR=emacs; VISUAL=emacs; export
EDITOR VISUAL" into your .profile file.

     -------------------- end excerpt --------------------

    I have "setenv EDITOR emacs", but not "setenv VISUAL emacs" in my .cshrc
file, but then I'm using 'rn' instead of 'nn'.  A second poster said that
if your login shell was sh, bash, or ksh, you'd need
	EDITOR=/usr/local/bin/emacs
	export EDITOR
in your .profile.

    Well, there's my summary.  I also have a long (> 1100 line) collection
of Usenet articles on KILL files, which also discusses the differing
syntax of gnus KILL files, and a copy of the news.newusers.questions 'rn' 
KILL file FAQ, which I can email to interested netters.  Have a nice day!

------------------------------ gnus KILL files ------------------------------

In general, I have found that most 'rn' entries have a clean translation to
'gnus' syntax.

Note for the lazy .. when reading a post from an offensive poster or on an
offensive thread, here's how to avoid all this syntax stuff ..
    1)  type esc-k		[sets up KILL file edit]
    2a) type ctl-c ctl-k ctl-a	[adds preformatted kill-by-author entry]
    2b) type ctl-c ctl-k ctl-s  [adds preformatted kill-by-subject entry]
    3)  type ctl-c ctl-c	[saves KILL file and exits edit]

The (fictional) assumed group is   talk.politics.flamewars.
The KILL file is located in ~/News/talk.politics.flamewars.KILL, by default.

Note the difference from the location of the 'rn' KILL file.  BTW, if you
use the esc-k method, you won't need to use that info .. 'gnus' locates the
file for you.

I still don't know how to translate the 'rn' entry
    /^From: hero@merlin\.wizard\.edu/h:M:=:shero
so I'll leave it out for the present.  When I learn how to, I'll add this
info.

------------------------- rn KILL file -------------------------
/^From: bogusman@turkey\.clueless\.edu/h:=:j
/^From: loser@tengallon\.bitnet\|^From: lostit@dribble\.UUCP/h:=:j
/^From: crazy@*cs\.looneybin\.edu/h:=:j
/^From: flamer@cray\.system5\.com\|^From: fanatic@vaxn\.bsd\.variant\.edu/h:=:j
/^Newsgroups:.*[ ,]misc\.headlines\|alt\.conspiracy/h:=:j
/alt\.alien\.visitors/a:=:j
/test/=:j
------------------------- gnus translation -------------------------
(gnus-kill "From" "bogusman@turkey\\.clueless\\.edu")
(gnus-kill "From" "loser@tengallon\\.bitnet\\|^From: lostit@dribble\\.UUCP")
(gnus-kill "From" "crazy@[-_.A-Za-z0-9]*cs\\.looneybin\\.edu")
(gnus-kill "From" "flamer@cray\\.system5\\.com\\|^From: fanatic@vaxn\\.bsd\\.variant\\.edu")
(gnus-kill nil "^Newsgroups: .*\\(misc\\.headlines\\|alt\\.conspiracy\\)")
(gnus-kill nil "alt\\.alien\\.visitors")
(gnus-kill "Subject" "test")
------------------------- end of translation -------------------------

Note that the '\\|' is the equivalent of the 'rn' logical or.  The '\\(' and
'\\)' are the 'gnus' grouping symbols which bound alternates.  Note also that
the '.' in the group names need to be replaced with '\\.' in the 'gnus'
syntax.

A note on 'gnus' regexps .. these are a superset of the 'sed' regexps, and
are noticably more powerful.  Look in the Emacs manual, the Info entry on
regexps, or the Nutshell handbook 'Learning Gnu Emacs', by Deborah Cameron
and Bill Rosenblatt.

The regexp '[-_.A-Za-z0-9]*' in the example matches any combination of zero
or more occurances of -, _, ., A-Z, a-z, or 0-9.

================ End 'rn' + 'gnus' KILL file summary ================

Enjoy !

--
Charles Roten | Hughes-STX, Incorporated | 
  roten@cuba.gsfc.nasa.gov               | 'Use the Source, Luke!'
  7601 Ora-Glen Dr., Greenbelt, MD 20706 | 
  301-513-7805 (w),  301-317-0872 (h)    |            Obi-Wan Stallman
Newsgroups: soc.culture.china,soc.culture.hongkong,soc.culture.taiwan