🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
5 messages
5 total messages Started by Dana Brewer Thu, 11 Jul 1996 00:00
need help with script to add new newsgroups
#9245
Author: Dana Brewer
Date: Thu, 11 Jul 1996 00:00
29 lines
1307 bytes
I'm trying to create a perl script to read the unwanted.log and use
ctlinnd to add new newsgroups to active.  (These were some groups that
we had taken out of active because of disk storage problems - this is a
one-time program).

My code looks like:

$ctlinnd = 'ctlinnd'  (I actually have the full path name here)

while (<>) {

	($num,$name) = split(/ /,$_);
	system ctlinnd, "newgroup", $name;

}

This is generating a two-line entry in active:

misc.jobs.offered
 0000000000 0000000001 y

If I run the simple perl statement:
	system ctlinnd, "newgroup", "misc.jobs.offered";
it creates the correct entry in active.

Does anyone know what I'm doing wrong?

Re: need help with script to add new newsgroups
#9228
Author: Chantelle Keller
Date: Thu, 11 Jul 1996 00:00
45 lines
1892 bytes
Dana -

I believe you need to use "chop" to chop off the newline at the end of 
$name before you use it in the newgroup command.  Thanks for the idea 
though, I'm going to use it to update my own active file!

Hope that helps!
Chantelle

Dana Brewer wrote:
> 
> I'm trying to create a perl script to read the unwanted.log and use
> ctlinnd to add new newsgroups to active.  (These were some groups that
> we had taken out of active because of disk storage problems - this is a
> one-time program).
> 
> My code looks like:
> 
> $ctlinnd = 'ctlinnd'  (I actually have the full path name here)
> 
> while (<>) {
> 
>         ($num,$name) = split(/ /,$_);
>         system ctlinnd, "newgroup", $name;
> 
> }
> 
> This is generating a two-line entry in active:
> 
> misc.jobs.offered
>  0000000000 0000000001 y
> 
> If I run the simple perl statement:
>         system ctlinnd, "newgroup", "misc.jobs.offered";
> it creates the correct entry in active.
> 
> Does anyone know what I'm doing wrong?

=====================================================================
Chantelle Keller
Systems Programmer, Ithaca College
ckeller@ithaca.edu

Re: need help with script to add new newsgroup
#9330
Author: Dion Marshall
Date: Mon, 15 Jul 1996 00:00
49 lines
1812 bytes
In article 3515@nav.cc.tx.us, Dana Brewer <dana@nav.cc.tx.us> () writes:
>I'm trying to create a perl script to read the unwanted.log and use
>ctlinnd to add new newsgroups to active.  (These were some groups that
>we had taken out of active because of disk storage problems - this is a
>one-time program).
>
>My code looks like:
>
>$ctlinnd = 'ctlinnd'  (I actually have the full path name here)
>
>while (<>) {
>
>	($num,$name) = split(/ /,$_);
>	system ctlinnd, "newgroup", $name;
>
>}
>
>This is generating a two-line entry in active:
>
>misc.jobs.offered
> 0000000000 0000000001 y
>
>If I run the simple perl statement:
>	system ctlinnd, "newgroup", "misc.jobs.offered";
>it creates the correct entry in active.
>
>Does anyone know what I'm doing wrong?


If I remember my PERL correctly, the comma between "newgroup" and $name in
a system statement is replaced with a "return" by default.

Change it to:
	system ctlinnd, "newgroup ".$name;

"Dot" is the concatination operator.

Dion
---

--
Pay no attention to the address behind the "From:" line!
Address all mail to:
		marshald@cbc.com (work)
	 or dion.marshall@pobox.com (home) 


Re: need help with script to add new newsgroup
#9400
Author: Harry Bochner
Date: Wed, 17 Jul 1996 00:00
35 lines
1713 bytes
In article <1996Jul15.173644.24474@cbgate.cbc.com>, marshald@cbc.com (Dion Marshall) writes:
|> If I remember my PERL correctly, the comma between "newgroup" and $name in
|> a system statement is replaced with a "return" by default.

No, actually.
The problem is that the input line contains a LF character to start with,
and the "split" operation leaves it in the $newgroup variable.
Adding the command
chop;
before the split should solve the problem.

|> Change it to:
|> 	system ctlinnd, "newgroup ".$name;
|> "Dot" is the concatination operator.

This passes 'newgroup xyz\n' to ctlinnd as a single argument, and gets
the following response from ctlinnd
> Usage error (unknown command) -- try -h for help.

You could use
system "ctlinnd newgroup $name";

If there's only one scalar argument to system(), perl splits that argument
into words, and that gives the right results.
(Even if the name contains a \n, as I just determined by the experimental
method ;-)

Hope this helps,

-- 
Harry Bochner
bochner@das.harvard.edu

Re: need help with script to add new newsgroup
#9402
Author: Vince Vielhaber
Date: Wed, 17 Jul 1996 00:00
37 lines
1926 bytes
In article 3515@nav.cc.tx.us, Dana Brewer <dana@nav.cc.tx.us> () writes:

>I'm trying to create a perl script to read the unwanted.log and use
>ctlinnd to add new newsgroups to active.  (These were some groups that
>we had taken out of active because of disk storage problems - this is a
>one-time program).

Although it's not perl, this works quite well.  I manually edit the 
unwanted.log to get rid of groups that I know aren't valid first. I
had considered adding a yes/no prompt per group, but since there are
so many more no's than yes's, I found it easier to clean it up some
with a few greps and a pass thru pico.



for grp in `awk '{print $2}' < unwanted.log` ; do
        echo "Newgrouping $grp"
        ctlinnd newgroup $grp y xxx@yyy
        done
echo "all done"
echo
cp /dev/null unwanted.log



Vince.
-- 
-----------------------------------------------------------------------------
Vince Vielhaber -- KA8CSH     Email: vev@msen.com      Flame mail: /dev/null
             Database Manager Michigan Area Repeater Council
                  MSEN.COM is NOT the Microsoft Network!
# include <std/disclaimer.h>                              TEAM OS/2
-----------------------------------------------------------------------------


Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads