Article View: news.software.readers
Article #2014Re: Automatic saving of newsgroups?
From: Adri Verhoef
Date: Sat, 15 Aug 1992 03:06
Date: Sat, 15 Aug 1992 03:06
121 lines
5350 bytes
5350 bytes
Julie Kangas (julie@eddie.jpl.nasa.gov) wrote:
>:
>: I'm using the nntp version of rn and am looking for a way
>: to automatically save all postings in certain newsgroups
>: while I'm away on vacation. Has anyone done this before?
While tin still doesn't handle crossposts (major gripe, Iain!),
here's how to do it with rn:
(Hey, it's useful to save useful articles. :-)
From: dellwo@ottawa.scs.uiuc.edu (Martin J. Dellwo)
Newsgroups: news.software.readers
Subject: Re: Automatic Downloading from rn
Summary: long, but useful
Date: 13 Nov 91 01:15:58 GMT
Lines: 104
In article <0+h_Ss#@engin.umich.edu> lou@zug.csmil.umich.edu (Lou Rosenfeld) writes:
>I posted this question a week or two back with no
>response, but I'm quite desperate. Is there a way
>that postings can be automatically downloaded via
>rn? I want to capture a number of postings locally
>...
>--Lou Rosenfeld
It seemed to me that one should be able to do this without too much
trouble, given various options to rn, so I pulled out my trusty printed
man page for rn and....
Ok, sounds like you want to:
1) check a newsgroup to see if it has articles
2) start up rn to go to that specific newsgroup
3) save every unread article in the group
4) mark it as read (junk it)
5) exit cleanly without entering any other groups
The following script plus the appropriate KILL file can do this,
assuming you are in UNIX (you *are* running rn). I tried it, it
worked fine. First the script, then some explanations.
-----rn.script (snip,snip,snip)--------------
#! /bin/csh
if !($#argv == 1) then
echo 'No newsgroup specified'
exit
endif
if !( { rn -csq $1 } ) then
echo Extracting news from group $1.
rn -q -T -N $1 <<eof
yqq
eof
else
echo No news in group $1.
endif
---------------end---------------------
Make the script executable (chmod +x rn.script)
Make a kill file in your directory for each newsgroup you will be
checking. For instance, for group news.software.readers, it's
*likely* to be ~/News/news/software/readers/ by default (but you
can change that: RTFM!). In this directory, create the file 'KILL'
with the line
/^/s:j
This will tell rn to save every article in this group, and junk it.
The article will be saved, in this form, by it's article number.
If you wanted to append all of them to some single file 'bigfile',
you could use the line '/^/s bigfile:j' instead. The format is set
by the '-N' option to be non-mailbox (see below).
Invoke for each newsgroup you want: eg. for news.software.readers
rn.script news.software.readers
You could direct the output to be appended to a logfile
thusly:
rn.script news.software.readers >>& ~/rn.log
Explanations
The first if-then checks for one-and-only-one argument to
the script.
The second if-then uses 'rn -cqs $1' to see if the group has unread
news. If it does, it proceeds to extract it. The actual extraction
uses the command 'rn -q -T -N $1'. The '-q' bypasses automatic
checking for new newsgroups. Since it is invoked with the specific
newsgroup from the argument $1 and you already checked for unread
news, it will go immediately to the 'Read group?' prompt for that
group. The option '-T' allows type-ahead, otherwise the input (on
the next script line) might get swallowed. I presume not having type-
ahead would cause this script to fail, though I didn't try it.
The '-N' option causes the save-command to use non-mailbox format, so it
won't prompt you about this. If you want mailbox format, use '-M' to
replace '-N' in the script.
The '<< eof' indicates that everything on the subsequent script lines
will be used as standard input to the 'rn' program, up until it encounters
'eof' on a line by itself. Which is why I didn't indent my if-then lines:
'<tab>eof' doesn't cut it, it's gotta be just 'eof'.
So fine, the input is 'yqq': 'y' for yes, read this group, 'q' for quit this
group (at the 'End of group...' prompt, after the articles were all saved)
and 'q' to quit rn rather than visit any more groups.
If you don't want to have a permanent killfile, use a local variation:
eg. at the beginning of the script, you could put the line
setenv KILLLOCAL "%p/%c/KILLBATCH"
then create the file KILLBATCH in the appropriate directory. In fact, I
recommend it!
Easy!! :-)
Marty
--
* Slade Mailing List: slade-request@rivm.nl | Did you know
* European top 20 : a3@rivm.nl | that applauding
* Nederlandse songfragmentenquiz: a3@rivm.nl (Adri Verhoef) | causes
* Dutch Artists Lyrics Quiz : a3@rivm.nl | blindness?
Technical Details
Message-ID:
<Bt08M4.G6M@rivm.nl>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!sparky!uunet!mcsun!sun4nl!rivm!a3References:
<1992Aug6.164437.29915@mahendo.jpl.nasa.gov> <1992Aug11.052032.6626@anl433.uucp>Show Full Headers
Complete Article Headers
Message-ID: <Bt08M4.G6M@rivm.nl> Subject: Re: Automatic saving of newsgroups? Date: Sat, 15 Aug 1992 03:06:04 GMT From: a3@rivm.nl (Adri Verhoef) References: <1992Aug6.164437.29915@mahendo.jpl.nasa.gov> <1992Aug11.052032.6626@anl433.uucp> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!sparky!uunet!mcsun!sun4nl!rivm!a3 Newsgroups: news.software.readers Sender: news@rivm.nl Organization: Rijksinstituut voor Volksgezondheid en Milieuhygiene,Bilthoven,NL Lines: 121