🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.admin.technical
Article #60

Scanning out the "For your newsgroups file:" line

#60
From: Gregory G. Woodbury
Date: Mon, 25 Jan 1993 02:40
82 lines
3206 bytes
Last week I posted an inquiry for a piece of sed or other code that
would give me the line FOLLOWING the "For your newsgroups file:" line
that David Lawrence (tale@uunet.uu.net) and other place in the newgroup
messages for NetNews.

I figured that it would be a simple one liner or so, but it turns out to
be a rather subtle bit of code.

All three of the responses I got are basically the same bit of code from
the INN newgroup script.  Two are from the released versions, and David
sent the latest and greatest from uunet.

John Schmitz answered first with:
	>From duke!dtc.hp.com!schmitz%scd.hp.com  Mon Jan 18 15:36:03 1993
	>Date: Mon, 18 Jan 1993 10:36:47 -0800
	>From: John Schmitz <duke!dtc.hp.com!schmitz%scd.hp.com>

${SED} <${ARTICLE} >>${NEWSGROUPS} -n -e '
        :top
        /^For your newsgroups file:$/b print
        n;b top
        :print
        n;p;q'

Then David Lawrence sent this version:
	>From duke!uunet.uu.net!tale  Mon Jan 18 22:51:35 1993
	>From: duke!uunet.uu.net!tale (David C Lawrence)
	>Date: Mon, 18 Jan 93 17:00:27 -0500

This is how INN does it:

${SED} <${ARTICLE} >>${NEWSGROUPS} -n -e "
:top
/^For your newsgroups file:\$/b scan
n
b top
:scan
n
/$1[    ]/ {
p
q
}
b scan"

And finally Ken Sallenger sent this (edited) comment and code fragment.
	>From duke!animal.csd.scarolina.edu!ken  Thu Jan 21 15:36:53 1993
	>Date: Thu, 21 Jan 93 15:08:42 EST
	>From: Ken Sallenger <duke!animal.csd.scarolina.edu!ken>

I append a fragment from the INN newgroup script.  It's not that
simple (for me at least).  I had to read the sed(1) man page
very carefully, several times, to be sure I understood this one!

The comment is mine; the GNU sed that I was using made a real
hash out of the end of our newsgroups file, so I switched back
to /bin/sed.

==== INN code courtesy of Rich Salz, INN version 1.2 ====
# USC-kws Tue Dec 22 15:47:27 EST 1992
#
#  Substituting /bin/sed for GNU sed, as we get bad results.
#  Specifically, printing was *on* from BOF to the newsgroups line,
#  the line prints OK, then OK (i.e. no printing) to EOF.
#
case $WORD in
created)
    /bin/sed <${ARTICLE} >>${NEWSGROUPS} -n -e '
        :top
        /^For your newsgroups file:$/b print
        n;b top
        :print
        n;p;q'
    ;;
esac

My thanks to the respondents, and to Rich Salz (the presumed author of
the code in question.)
-- 
Gregory G. Woodbury @ The Wolves Den UNIX, Durham NC  <Standard disclaimers>
UUCP: ...dukcds!wolves!ggw   ...duke!wolves!ggw           [use the maps!]
Domain: ggw@wolves.Durham.NC.US  ggw%wolves@duke.cs.duke.edu
[This site is *not* affiliated with Duke University.  (Idiots!) ]
Technical Details
Message-ID: <1jvjvpINN8mb@ftp.UU.NET>
Path: arc1-ca.pugleaf.net!sparky!uunet!not-for-mail

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!not-for-mail
From: ggw@wolves.Durham.NC.US (Gregory G. Woodbury)
Newsgroups: news.admin.technical
Subject: Scanning out the "For your newsgroups file:" line
Followup-To: news.admin.misc
Date: 24 Jan 1993 21:40:57 -0500
Organization: Wolves Den UNIX
Lines: 82
Sender: zorch@ftp.UU.NET
Approved: zorch@uunet.UU.NET
Distribution: world
Message-ID: <1jvjvpINN8mb@ftp.UU.NET>
Reply-To: ggw@wolves.durham.nc.us
NNTP-Posting-Host: ftp.uu.net
Summary: INN does it