🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #74216

Renaming a newsgroup

#74216
From: John F. Morse
Date: Sun, 10 Sep 2006 12:12
100 lines
4696 bytes
Looking at Russ's "INN 2.x FAQ" Section 6.5 "Rename a newsgroup"

Jeff has contributed the following Perl:

#!/usr/bin/perl -wi
my ($src, $dst) = (shift, shift);
die "Usage: $0 oldgroup newgroup [file1 [file2 ...]]\n"
    unless(defined $dst);
while(<>) {
    s/$src/$dst/g if 1 .. /^$/ and /^(Newsgroups|Followup-To|Xref):/i;
    print;
} continue {
    close ARGV if eof;
}

I have this in a textfile I created called "renamer.pl"

But before I execute it, I have a feeling that I need to supply the 
names of the groups on which I want to work.

To make it simple (testing one group for now), and to protect the 
working spool, I have copied my ~/articles/local/test files to a new 
directory, within the local.* directory. Clear as mud? Here were the steps:

news@optima2:~/articles/local/test$ ls
1   100  103  108  11   111  13  15  17  20  22  24  26  28  3   31  33  
35  8  96
10  101  107  109  110  12   14  16  2   21  23  25  27  29  30  32  34  
36  9  99
news@optima2:~/articles/local/test$ cd ..
news@optima2:~/articles/local$ ls
announce  test
news@optima2:~/articles/local$ mkdir test1
news@optima2:~/articles/local$ ls
announce  test  test1
news@optima2:~/articles/local$ cd test
news@optima2:~/articles/local/test$ cp * ../test1
news@optima2:~/articles/local/test$ cd ../test1
news@optima2:~/articles/local/test1$ ls
news@optima2:~/articles/local/test1$ ls
1   100  103  108  11   111  13  15  17  20  22  24  26  28  3   31  33  
35  8  96
10  101  107  109  110  12   14  16  2   21  23  25  27  29  30  32  34  
36  9  99

The "renamer.pl" script was put into the test1 directory. I don't know 
if that is a good place for it or not.

Now, the question(s) I have:

Where in these two lines do I change the variables to "test" and "test1":

    my ($src, $dst) = (shift, shift);
    die "Usage: $0 oldgroup newgroup [file1 [file2 ...]]\n"
        unless(defined $dst);


Would they be "oldgroup" and "newgroup" becoming "test" and "test1"?

Such as:

die "Usage: $0 test test1 [file1 [file2 ...]]\n"

What is the "shift, shift" for? Are they the values for local variables 
$src and $dst?

And what are the optional [file 1 [file2 ...]] labels?

It would probably make it easier to visualize if this script had the 
test and test1 simply plugged in for me to see.

Finally, what could I do if I wanted to rename the header info in both 
local.announce and local.test (local.*)?

Or in ~/articles/* if these multiple directory changes are even 
possible? If not, I would be required to run the Perl script from within 
each directory in ~/articles ?

I'm doing this "lab assignment" on a retired server (optima2) so I won't 
wreck the online server. If it works out OK, I may rename the five 
original ("brisbee") groups to something more local, like the "xanadu.*" 
hierarchy, to keep from accidental leaking, etc., on the online server.

They were named over five years ago, so I can't go back to the beginning 
now, and I don't want to discard all of the history in these "local" 
groups. Having the local groups all under one hierarchy will also make 
it easier for the users to find them in their newsreader list, and may 
remind them that the other groups are pushed out to Usenet.

Today I noticed one user posting in the local group "computers" after he 
looked around for awhile in the Big Eight comp.* hierarchy. So it can be 
confusing, especially the computers group.

Either way, I'm bound to learn a little bit about Perl, and can use the 
lesson down the road.

TIA.

-- 
John
Technical Details
Message-ID: <AiTMg.17827$QM6.1566@bgtnsc05-news.ops.worldnet.att.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!17a21c27!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <AiTMg.17827$QM6.1566@bgtnsc05-news.ops.worldnet.att.net>
Subject: Renaming a newsgroup
Date: Sun, 10 Sep 2006 12:12:16 GMT
From: "John F. Morse" <xanadu.bbs@invalid.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!17a21c27!not-for-mail
Reply-To: xanadu.bbs@invalid.net
Organization: Xanadu BBS
User-Agent: Debian Thunderbird 1.0.2 (X11/20060423)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: news.software.nntp
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 100
NNTP-Posting-Host: 07ef3c708a928d9c2bbc3fddedcad1c6
X-Complaints-To: abuse@worldnet.att.net
X-Trace: bgtnsc05-news.ops.worldnet.att.net 1157890336
NNTP-Posting-Date: Sun, 10 Sep 2006 12:12:16 GMT