Archive-name: killfile-faq

Last modified: 21 Oct 1995



Copyright 1995, Leanne Phillips. Permission is granted to distribute this

document for personal use, as long as this copyright notice maintains.

Publication of this material in printed form is forbidden without express

permission of the author.



Summary of changes:

	Oct 21: Added a caution and correct to question 15 about from line

killing.



Send comments, suggestions, corrections to felan@netcom.com.



Questions answered in this post:

1. What is a KILL file?  What does it do?

2. What's the difference between a 'local' KILL file and a 'global'

	KILL file?

3. How can I change/edit my KILL files?

4. What's this 'THRU' line in my KILL file?

5. What is the general syntax of a KILL file entry?

6. What are the available modifiers and commands?

7. How do I kill a specific subject?

8. How do I kill postings from a specific person?

9. How do I kill articles from a specific site?

10. How do I kill followups?

11. How do I kill crossposts from a specific group?

12. How do I kill all crossposts?

13. I know how to kill posts from a specific person. How do I make it so I

	read _only_ the posts from a specific person?

14. How do I kill something if it appears in the article body?

15. What's different about trn?

16. There's a way in rn to select only the articles I want to read;

	the /pattern/:=:M method. Is there a way to do that in trn?

17. Can I select on a given thread?

18. How do I kill a given thread?

19. How do I kill the followups to a posting without killing the entire

	thread?

20. How do I kill something in the header that isn't in the subject line?

21. Can I kill articles without using a killfile?  If so, how?

22. Where can I get more information about killfiles, regular expressions,

	and trn?

23. Comments from the maintainer, and credits



			The KILL file FAQ



General information

===================

1. What is a KILL file?  What does it do?



  A KILL file is a way of recording what articles you want to kill (skip

over).  Rn, trn, and strn all support killfiles.  Xrn has some support for

killfiles, but the support is limited; nothing in here is guaranteed to work

for xrn.  See the xrn man page.

  To kill articles, you specify criteria to use to kill them: a subject line,

a part of a subject line, articles from one poster or one site, cross-

posted articles, or follow-ups to other articles.  You can also kill articles

with a particular string in the article.



2. What's the difference between a 'local' KILL file and a 'global'

	KILL file?



  The 'global' KILL file - there is only one for each user - is applied

to each newsgroup.  A 'local' KILL file is applied to only one newsgroup,

the one for which it is named.

  The global KILL file is typically in your News directory, under the name

'KILL'.  Local KILL files are typically in the News directory, with more

involved names.  The killfile for group foo.bar would be, in the News

directory, in the subdirectory foo/bar.  It would still be named KILL.

  (Note: The capitals are important; remember that Unix is case-sensitive.)

  It is possible to change the locations of your KILL files, by setting

the environment variables KILLGLOBAL and KILLLOCAL.  The most popular method

is to put all the files in one directory using the group name as the

file name:



	KILLLOCAL="%p/Kill/%C"

	KILLGLOBAL="%p/Kill/Global"



Where %p is the news dir (~/News) and %C is the name of the group.  The

global kill file is in the same directory with the name "Global".

  See your rn(1) or trn(1) man pages, or local support staff, for help

with this if you want to use something else.



  A word of warning about global kill files: they slow down killfile

processing, so you have to wait longer to start reading - for each

newsgroup.  If you don't need to put something in a global file, you

shouldn't.



3. How can I change/edit my KILL files?



  The easiest way to add a given subject to your KILL file is to start

reading the first article with that subject, and then to type 'K'

(the capital is important).  It will be added automatically.  The subject

that is added will be some of what shows up in the Subject: line, so

there isn't much flexibility in it.  (What is actually added is the first

twenty or so characters of the Subject: line, not the whole line.)



  Assuming you know how to use an editor and have made that editor your

default (again, see local support staff if you don't know how to do that),

you can edit the KILL file directly, using the appropriate name as

described above.



  From within rn and trn, you can add something to a killfile when typing

in the kill command interactively (see below, the question about killing

without using a killfile).  Use the K modifier in any command (see below

for explanations of modifiers).

  You can also start editing your KILL files from within rn and trn.  When

being asked to pick a newsgroup, type control-k; this will start your

default editor, using your global killfile.  When you're reading a

particular newsgroup, typing control-k will start the editor with the

local killfile for that group.  If it doesn't exist, it will create it;

if necessary, it will also create the directories in the path to it.



4. What's this 'THRU' line in my KILL file?



  The THRU line, at the top of every local KILL file, indicates how many

articles have been processed by the KILL file.  It's the number of the

article it last processed.  No articles before that number will be

looked at by the KILL file again, even if you add an entry to the KILL

file.  You need to change the THRU line as well.



Rn and trn

==========

5. What is the general syntax of a KILL file entry?

  The general style for building a kill line is:



		/pattern/modifiers:command



  The <pattern> is the pattern to use to pick articles.  This is a regular

expression, like those used in grep.  You can use any case in the pattern; 

t won't matter, unless you use a modifier to make rn case-sensitive.

  The <modifiers> tell rn where to look for the pattern - the subject

(default), one of the other header lines, or the entire article, as examples

of the usual modifiers used.

  The command tells what to do with the article once it's been selected.

This is usually either to kill it or to mark it unread.



  If no modifier appears before the colon, only the subject line of the

article is searched.  More than one command can be performed by using

the style:



		/pattern/modifier:command:command 



Thus, for instance, you can use j and = together to see the exact subject

lines being killed.  (See below for the explanation of j and =.)



6. What are the available modifiers and commands?



  The modifiers and commands are all explained in the rn man page, but here

are some of them:

	Modifiers:

	   a: all, look through the entire article for the pattern

	   h: look through the header of the article for the pattern

	   f: look at only the 'From:' header (trn 3.0)

	   c: Make the pattern case sensitive

	   H: added in trn 3.1, this expands the f: above to any header

	Commands:

	   m   mark as unread

	   j   mark as read

	   =   show subject line



  Using the 'a' modifier slows down kill file processing a lot; use it

sparingly.



7. How do I kill a specific subject?



  The easiest way to kill a subject line is to kill it from within the

newsgroup.  When the subject line comes up that you want to kill, instead

of using 'n' to skip that article or 'k' to kill the subject for that 

session, type 'K'.  The subject line will then be entered into your KILL

file for that group.  If you want to put that line into your global KILL

file, you'll have to do that yourself.



  To kill a general subject, ie any 'test' messages, put in the pattern:



			/test/:j



This will kill anything with the word 'test' in the subject line.



8. How do I kill postings from a specific person?



  To kill articles from a single poster, you need to know the userid and

nodename of the poster; for this example we'll use noone@anywhere.all.



		/^From:.*noone@anywhere\.all/h:j



This searches the entire header for any line starting with 'From:', anything

at all, and then 'noone@anywhere.all' in it.  This is faster than if the

beginning-of-line character (^) had been left out:



		/From:.*noone@anywhere\.all/h:j



If this were used, something like 'Subject: Re: Articles from:

noone@anywhere.all' would also get killed.



9. How do I kill articles from a specific site?



  For articles from a particular site, just remove the 'noone' from the

previous lines, and articles from the machine 'anywhere.all' will be killed.

So, the line would be:



		/^From:.*@anywhere\.all/h:j



10. How do I kill followups?



  To kill anything that is a followup to any article, use this pattern:



		/Re:/:j



This kills anything with 'Re:' in it.  (This includes articles of the form

'Subject: X (Was Re: Y)'.)



  If you just want to kill the direct followups, without the changes in

subject, you have to make it clear where the Re: is in the line:



		/^Subject: Re:/:j



11. How do I kill crossposts from a specific group?



  To kill cross-posts from one particular group, say foo.bar, try this:



		/^Newsgroups:.*[ ,]foo\.bar/h:j



This searches the header (the 'h' modifier) for any line containing the

string 'Newsgroups:' (which all articles do), as well as the string

'foo.bar'.  The other elements of this line are part of the regular

expression meta-language; see the ed(1) man page for more details.

(Note that all of them are necessary, particularly the '\' before the

'.' in foo\.bar.)



  This will also match a newsgroup of foo.bar.misc; to fix it, you'd need

to use some of the other techniques, described below, for unmarking things

you wanted to see that were killed by other commands.



12. How do I kill all crossposts?



  Since a cross-posted article always has a , in the Newsgroups: line,

you can use:



		/^Newsgroups:.*,/h:j



to kill all crossposts.



13. I know how to kill posts from a specific person. How do I make it so I

	read _only_ the posts from a specific person?



  Now, after your normal kills, you might suddenly find out that you killed

articles from someone whose posts you want to read even if they write about

subjects you don't want to read.  For that, you need to 'unkill' the articles

by them:



		/^From:.*name of person you want to read/h:m



So, if you suddenly decided you wanted to read noone@anywhere.all's 

postings, after having deleted them above, you would add this line:



		/^From:.*noone@anywhere\.all/h:m



The 'm' becomes useful suddenly.  You can substitute m for j any time

you need to, in any of the commands already discussed.  In fact, you can

kill everything in a newsgroup and only read what you want to read by using

the 'm' feature, and putting this line at the top of your KILL file:



		/^/:j



  This method has a problem, though.  Specifically, it marks even those

you've already read (really read, not just marked as read) as unread.  So,

there's another way to do it:



			/pattern/:=:M



(check the rn(1) man page for the M command).  This lists all the subjects

of the new articles, and then gives those articles to the M command.  (You

then have to type 'Y' after the M command has finished.)  (For more complete

information, see the example in the 'Comments and credits' section.)



14. How do I kill something if it appears in the article body?



  Use the a modifier to pick the pattern and kill it:



		/<pattern>/a:j



Trn

===

15. What's different about trn?



  Trn, being a threaded version of rn, has a few extra enhancements to

deal with those.  Because rn is no longer being improved, there are also

extensions that have been made that could, but are not, be integrated into

the base rn killfiles.

  One of the additions to trn is the f modifier, meaning the From: line.

This line gets used so much it seemed appropriate to add a modifier in

specifically for it.

  So, now, killing or marking articles can be done on the basis of the

From: line quite easily, now:



		/noone@anywhere\.all/f:j

		/noone@anywhere\.all/f:m



It looks just like the Subject: line, except with the addition of the 'f'

in the modifier position.



  However, the `f' modifier *may* not work exactly in the same manner as

the subject-based criteria if trn is configured to use thread files.

Specifically, if thread files are used only the 'Real Name' portion of the

from line can be guaranteed to be matched.  To ensure that your match will

work on an address, you need to change the above lines to:



              /noone@anywhere\.all/Hfrom:j

              /noone@anywhere\.all/Hfrom:m



16. There's a way in rn to select only the articles I want to read;

	the /pattern/:=:M method. Is there a way to do that in trn?



  Yup.  You do it in essentially the same way, but you replace the :=:M

with :+, like this:



		/noone@anywhere\.all/f:+



17. Can I select on a given thread?



  Just type 'T+' while reading any thread or while selecting a thread in the

selector (it's similar to using 'K' on an article, except it selects).

This will tell trn to select the entire thread by putting thread-oriented

selection commands in the kill file that look like this:



<879387.message.id@some.site.name> T+



You can also use 'T+' on a search command, if for instance you wish to

select a thread that starts with a particular subject and keep on seleting

it even if the subject changes:



  		/test/:T+



18. How do I kill a given thread?



  Just type Tj while reading the thread or when the thread is the current

item in the thread selector.  Use this instead of 'K' to kill only this

thread and not other threads that have a similar subject.  It also puts

thread-oriented kill commands in kill file that have 'Tj' instead of 'T+'

on the end.



You can also use 'Tj' on a search command, if you wish to kill a particular

subject and all associated subjects in the thread:



		/test/:Tj



19. How do I kill the followups to a posting without killing the entire

	thread?



  Use the ',' command, intead of the 'j' command of rn.



20. How do I kill something in the header that isn't in the subject line?



  You can, in trn 3.1, kill anything from a specific header line, rather than

using the h: modifier to search the entire header.  It looks like the subject

line one, with a simple change:



	   /string to junk/Hheader:j



That is, the modifier becomes 'Hreferences' or 'Hpath' or whatever header

it is you want to search.



  An example is crossposts from a particular newsgroup:



		/foo\.bar/Hnewsgroups:j



or from all newsgroups:



		/,/Hnewsgroups:j



Using this syntax will be faster than the method used in rn to find a

particular header, as well as simplifying the necessary pattern.



'Catchall'

==========

21. Can I kill articles without using a killfile?  If so, how?



  Sure can.  Just type in the appropriate command while reading the

newsgroup.  You can also do it from the thread selector.  For instance,

if you're selecting threads and decide that someone's posted too much,

you can just type:



		/noone@anywhere\.all/f:j



  Any of the other commands will also work.



22. Where can I get more information about killfiles, regular expressions,

	and trn?



  Regular expressions are used in ed, a line editor seldom used on Unix

by most people.  The man page for ed(1) explains the various regular

expression syntax rules.



  Killfiles and trn are both described in the trn(1) man page.  Some sites

may not have this installed; if not, please see your local support staff to

see if it is possible to get it installed.

  A post has been written about trn; occasionally the author posts pointers

to the ftp location in news.software.readers.  This is recommended for people

new to using trn.

  For any of the trn extensions, it is highly recommended that you check

the man page on your system.  They weren't added until version 3.0, most

of them; some weren't added until later.  If you have an earlier version,

you should see if an upgrade is possible.



23. Comments from the maintainer, and credits



  I'd like to thank Jonathan Kamens and Rich Salz in particular for their

help, and everyone else who's sent in comments, criticisms, and suggestions;

keep them coming, folks!  Wayne Davison (writer of trn) helped in the

rewrite in substantial ways; some of that included writing a couple sections

that I was particularly unsure about.

====

Minor administrative note to the suggestors: Several people have suggested

that, in junking all of the articles and then marking only the desirable

ones to read, you need to use the 'r' modifier (search read articles as

well as unread).  According to the man page, you don't need that;

if 'm' is the first command, the 'r' is assumed.

====

Example of killing all articles, and then unkilling those for a specific

topic or person (this example was provided by David W. Tamkin,

dattier@gagme.chi.il.us):



Let's say that your kill file has processed through article 1000 and there

are nine new articles now.  You have a kill file that looks like this:



THRU 1000

/bear/:=:M

/^/j



Note the use of :=:M instead of m.



Now, articles 1002, 1003, and 1006 have "bear" in their subjects.  The =

operator in /bear/:=:M will allow rn to use that line only on unread

articles.  Thus, 1002, 1003, and 1006 get marked for return.  Next, /^/j

junks all articles from 1001-1009.



Then you type Y (yank articles Marked for return).  Alternatively, if you do

leave the newsgroup and come back to it, your kill file now looks like this:



THRU 1009

/bear/:=:M

/^/j



Because the kill file has already operated on articles 1-1009, it will not

run = (and thus it won't get to the M) nor j on 1002, 1003, and 1006.  You

can hit <space> or y and start reading them.



Without the :=: trick, M or m will operate on all articles, read or unread.

====

Additions to the example, for trn 3.x:



The rn example uses:



		THRU 1009

		/bear/:=:M

		/^/j



While this works in later versions of trn 3.x, the best way to do this in trn

3.x is to put the following into your kill file:



		/bear/:+

		*X



The '*X' command kills all non-selected articles in the group.



  In rn, M and m both work on both read and unread articles.  This is not

true in trn 3.x, for M: it only works on unread articles.  What this _means_

is that, when using the :=:M trick, you can actually remove the :=:, and

just use the M.

====



Leanne Phillips

