[comp.unix.questions] string search in "rn"

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (01/16/91)

In article <19522@hydra.gatech.EDU> mb33@prism.gatech.EDU (Martin Brooks) writes:
: 
: In one of my KILL files, I have a couple of search commands to flag
: articles that were posted locally:
: 
:    /string1/h:=
:    /srting2/h:=
: 
: Is there a way to search for both strings with one command.  I *did*
: RTFM but either it didn't mention anything or I overlooked it.

    /string1\|string2/h:=

If you know the header line, you can also get fancy with %(), like this

    /^/%(%[from]!=string1\|string2?j:=)

This lists the article if the From: line contains string1 or string2,
otherwise it junks the article.

Larry Wall
lwall@jpl-devvax.jpl.nasa.gov

clc5q@shamash.cs.Virginia.EDU (Clark L. Coleman) (01/23/91)

I have seen some neat tricks with KILL files, but how do you find the
documentation for this stuff? The man pages for "rn" are pretty much
useless (on my system, anyway) for sophisticated kills. (Put another
way: I am too stupid to figure it out from the man pages.) 

Specifically, I want to :

 1) Kill all news articles that were cross-posted to talk.politics.mideast,
     to use one example.

 2) Kill all subjects containing a particular substring.

 3) Kill all postings from a particular poster.

Any pointers are appreciated.

-----------------------------------------------------------------------------
"We cannot talk of freedom unless we have private property." -- Gavriil Popov,
Mayor of Moscow, September 11, 1990. |||  clc5q@virginia.edu

tchrist@convex.COM (Tom Christiansen) (01/24/91)

From the keyboard of clc5q@shamash.cs.Virginia.EDU (Clark L. Coleman):
:I have seen some neat tricks with KILL files, but how do you find the
:documentation for this stuff? The man pages for "rn" are pretty much
:useless (on my system, anyway) for sophisticated kills. (Put another
:way: I am too stupid to figure it out from the man pages.) 

Maybe now that the perl book is done, Larry will write us one on rn. :-)
[No, I'm not quite serious.]

The information you seek is actually there.  Perhaps it's a little
hard to pick out.  Look for the string "modifiers" in the man page.

:Specifically, I want to :
:
: 1) Kill all news articles that were cross-posted to talk.politics.mideast,
:     to use one example.

/Newsgroups:.*talk.politics.mideast/h:j

: 2) Kill all subjects containing a particular substring.

/substr/:j

: 3) Kill all postings from a particular poster.

/From:.*poster/h:j



Hope this helps.

--tom
--
"Hey, did you hear Stallman has replaced /vmunix with /vmunix.el?  Now
 he can finally have the whole O/S built-in to his editor like he
 always wanted!" --me (Tom Christiansen <tchrist@convex.com>)

Dan_Jacobson@ATT.COM (01/25/91)

>>>>> On 22 Jan 91 20:24:58 GMT, clc5q@shamash.cs.Virginia.EDU (Clark L. Coleman) said:

Clark> I have seen some neat tricks with KILL files, but how do you find the
Clark> documentation for this stuff? The man pages for "rn" are pretty much
Clark> useless (on my system, anyway) for sophisticated kills.

Well, two wrongs make a right (you not at least posting this
originally to news.newusers.questions (actually it seems more advanced
than a "newuser" question) & me deluding you from rn with the
following GNUS [a different newsreader---use it inside GNU Emacs]
advertisement.)

Begin GNUS advertisement [for GNUS info, read newsgroup
gnu.emacs.gnus & write info-gnus-english-request@tut.cis.ohio-state.edu].

------
File: gnus  Node: Example of a KILL File, Prev: Editing KILL Files, Up: KILL File, Next: Advanced Kills

Example of a KILL File
======================

  The following is an example of a local KILL file for newsgroup
`control'.  This is currently being used by the author.

     ;; Apply to the newsgroup `control' if the NNTP server is flab.
     (if (string-equal gnus-nntp-server "flab")
         (progn
           (gnus-kill "Subject" "ihave flab\\|sendme")
           (gnus-kill "Subject" "cancel\\|newgroup\\|rmgroup" "d")
           (gnus-expunge "X")))


File: gnus  Node: Advanced Kills, Prev: Example of a KILL File, Up: KILL File

Advanced Kill Processing
========================

  Internally, applying kills means to run the hook
`gnus-Apply-kill-hook'.  It is called after the Subject buffer is
prepared for a selected newsgroup.  The default hook is the function
`gnus-apply-kill-file' which loads a global KILL file and a local KILL
file in this order.  A different style of the kill processing can be
implemented by customizing this hook.

  For example, if you think a global KILL file is unnecessary, you can
use the following hook which applies only a local KILL file.  This
change can save the time for checking the existence of a global KILL
file.

     (setq gnus-Apply-kill-hook
           '(lambda ()
              ;; Apply a local KILL file.
              (load (gnus-newsgroup-kill-file gnus-newsgroup-name) t nil t)))

  On the contrary, the following example enables only a global KILL
file.

     (setq gnus-Apply-kill-hook
           '(lambda ()
              ;; Apply a global KILL file.
              (load (gnus-newsgroup-kill-file nil) t nil t)))

  Here is an advanced example that drastically reduces the time for
applying KILL files.  This hook does the kill processing directly
without loading the KILL files.

     (setq gnus-Apply-kill-hook
           '(lambda ()
              ;; Apply to the newsgroup `control'
              ;; if the NNTP server is flab.
              (and (string-equal gnus-nntp-server "flab")
                   (string-equal gnus-newsgroup-name "control")
                   (progn
                     (gnus-kill "Subject" "ihave flab\\|sendme")
                     (gnus-kill "Subject" "cancel\\|newgroup\\|rmgroup" "d")
                     (gnus-expunge "X")))))


-- 
Dan_Jacobson@ATT.COM  Naperville IL USA  +1 708-979-6364