🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.readers
7 messages
7 total messages Started by admin Fri, 18 Sep 1998 00:00
How can I sort newsgroups?
#43290
Author: admin
Date: Fri, 18 Sep 1998 00:00
17 lines
1213 bytes
Hi, I'm using pre-version "Laura" of the TIN newsreader on linux.

Is there any way to get it to sort my newsgroup list alphabetically (either
ascending or descending)?

Thanx,

-Cygnus
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.
Anthony J. Biacco                           Network Administrator/Engineer
admin@intergrafix.net                        Intergrafix Internet Services

          "The best way to predict the future, is to invent it."
http://cygnus.ncohafmuta.com                    http://www.intergrafix.net
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.

Re: How can I sort newsgroups?
#43283
Author: Kim DeVaughn
Date: Fri, 18 Sep 1998 00:00
197 lines
7244 bytes
In article <6ttop4$nld$1@news2.xs4all.nl>,
	Jeroen Scheerder  <js@xs4all.nl> wrote:
|
| admin@intergrafix.net:
| >
| > Is there any way to get it to sort my newsgroup list alphabetically (either
| > ascending or descending)?
|
| Exit tin.  :-)   In the shell, type
|
| $ sort < $HOME/.newsrc > $HOME/.newsrc.sorted
|
| The file .newsrc.sorted is now, well, sorted.

Well, sort of (bad pun intended) ...

Unfortunately, a straight sort collates "-" and "!" before ".", and ":"
after it, which for newsgroups, can lead to inconsistent and/or undesirable
ordering.

For example, I think most people would agree that these newsgroups are
properly sorted:

 alt.fan.bruce! 1-81
 alt.fan.bruce.woodcock! 1-454
 alt.fan.bruce-becker! 1-655
 alt.fan.bruce-campbell! 1-8668
 alt.fan.bruce-kettler! 1-1420

but a straight "sort" on them, will result in:

 alt.fan.bruce! 1-81
 alt.fan.bruce-becker! 1-655
 alt.fan.bruce-campbell! 1-8668
 alt.fan.bruce-kettler! 1-1420
 alt.fan.bruce.woodcock! 1-454

unless you happen to be subscribed to alt.fan.bruce, in which case
you get:

 alt.fan.bruce-becker: 1-655
 alt.fan.bruce-campbell: 1-8668
 alt.fan.bruce-kettler: 1-1420
 alt.fan.bruce.woodcock: 1-454
 alt.fan.bruce: 1-81

Etc.


Enter the recumbent bicyclist, Leo Schwab, who was annoyed enough to
actually do something about it, which he posted in the best.* internal
newsgroups, and which I've been using quite successfully, ever since.

There are probably more elegant (and less cpu intensive) ways of doing
this, but working code in hand ...

I'll leave all the commentary on it, to provide the context of his
efforts.  Note that this has been tweaked for perl5, and IIRC, will
need some minor mods for perl4.

Anybody have a better solution that will give the same results ...?

/kim


#---- snip --------------------------------------------------------------------
#!/usr/local/bin/perl5
#
# usage:  ngsort infile >outfile
#
#From: ewhac@best.com (Leo L. Schwab)
#Newsgroups: best.general
#Subject: Sorting a .newsrc
#Date: 19 Jan 1997 23:24:11 -0800
#Message-ID: <5bv6ir$93n@shellx.best.com>
#Organization: Verbatim Corp.:  Abort, Retry, Ignore, Fail?
#
#
#[ yum ]
#
#        I have gotten it into my head to sort my .newsrc file.  However, I
#am having trouble working out a proper incantation to do it.
#
#        My first thought was to use sort(1), but because you can't force it
#to ignore everything from the ':' or '!' characters onward, some entries
#come out in the wrong place.  In particular:
#
#alt.foo.bar:   /*  will sort before  */
#alt.foo:
#
#        This because of the way the ':' character compares with '.'.
#
#        So then I thought of using Perl to do it (yeah, I know, atomic bomb
#to kill a fly).  Well, three hours later, I got nowhere, and decided to
#throw dignity to the wind and post a plea for help here.
#
#        All assistance appreciated.  Thanks.
#
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
#Leo L. Schwab -- Digital Spellweaver                   ewhac@best.com  ..or..
# \_ -_   http://www.best.com/~ewhac/                   ewhac@well.com
#O----^o  Recumbent Bikes: The Only Way To Fly.         (pronounced "EH-wack")
#                Hiroshima '45.  Chernobyl '86.  Windows '95.
#
#==============================================================================
#
#From: doosh@best.com (Tom Holub)
#Newsgroups: best.general
#Subject: Re: Sorting a .newsrc
#Date: 20 Jan 1997 11:48:45 -0800
#Message-ID: <5c0i6t$639@shellx.best.com>
#Organization: BEST Internet Communications
#
#
#In article <5bv6ir$93n@shellx.best.com>,
#        Leo L. Schwab <ewhac@best.com> wrote:
#)
#)        This because of the way the ':' character compares with '.'.
#
#From the sort man page:
#
#     -tx  Use x as the field separator character; x is not considered to be
#          part of a field (although it may be included in a sort key).  Each
#          occurrence of x is significant (for example, xx delimits an empty
#          field).  x may be a supplementary code set character.  The default
#          field separators are blank characters.
#
#So sort -t: should do it.
#
# -Tom
#
#==============================================================================
#
#From: ewhac@best.com (Leo L. Schwab)
#Newsgroups: best.general
#Subject: Re: Sorting a .newsrc
#Date: 21 Jan 1997 00:47:29 -0800
#Message-ID: <5c1vr1$5so@shellx.best.com>
#Organization: Verbatim Corp.:  Abort, Retry, Ignore, Fail?
#
#
#In article <5c0i6t$639@shellx.best.com>, Tom Holub <doosh@best.com> wrote:
#>
#>So sort -t: should do it.
#
#        Not quite.  'sort' needs to stop looking at either the ':' or the
#'!' character.  'sort' doesn't appear to allow more than one character as a
#field separator.
#
#        I finally beat Perl into submission and got the desired result.
#Experienced Perl programmers will probably sneer at the result, and I
#wouldn't blame you:
#
#_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
#Leo L. Schwab -- Digital Spellweaver                   ewhac@best.com  ..or..
# \_ -_   http://www.best.com/~ewhac/                   ewhac@well.com
#O----^o  Recumbent Bikes: The Only Way To Fly.         (pronounced "EH-wack")
#           Does J.R. "Bob" Dobbs shop for clothes at Fnordstrom?
#
#==============================================================================

#!/usr/local/bin/perl5
#
# usage:  ngsort infile >outfile

sub ngsort {
        my $aa = $a;
        my $bb = $b;
        my $retval;

        if ($aa =~ /(.*?)[:!]/) {
                $aa = $1;
        }
        if ($bb =~ /(.*?)[:!]/) {
                $bb = $1;
        }

        @aa = split(/\./, $aa);
        @bb = split(/\./, $bb);

        while ($aa = shift(@aa), $bb = shift(@bb)) {
                if ($retval = (lc($aa) cmp lc($bb))) {
                        return ($retval);
                }
        }
        return ($aa cmp $bb);
}

print sort ngsort <>;
#---- snip --------------------------------------------------------------------

-----------------------------------------------------------------------------
Kim DeVaughn             [  "All sweet things have one thing in common ...  ]
kimdv@best.com  /\oo/\   [   ... a tendency to make you sick."  --Soolin    ]
-----------------------------------------------------------------------------

Re: How can I sort newsgroups?
#43288
Author: Hello Kittyhawk
Date: Fri, 18 Sep 1998 00:00
27 lines
1394 bytes
In article <6ttthb$rn5$1@nntp1.ba.best.com>,
Kim DeVaughn <kimdv@best.com> wrote:
|
|Unfortunately, a straight sort collates "-" and "!" before ".", and ":"
|after it, which for newsgroups, can lead to inconsistent and/or undesirable
|ordering.
|
|For example, I think most people would agree that these newsgroups are
|properly sorted:
|
| alt.fan.bruce! 1-81
| alt.fan.bruce.woodcock! 1-454
| alt.fan.bruce-becker! 1-655
| alt.fan.bruce-campbell! 1-8668
| alt.fan.bruce-kettler! 1-1420


	Hey! Leave my name out of this sordid mess 8^)


-- 
  ,u,	 Bruce Becker		Toronto, Ontario	1 416 699 1868
a /i/	 Internet: bdb@gts.org	Uucp: ...!gts!bdb
 `\o\-e	 millihelen, n.  The quantity of beauty required to
 _< /_	 		 launch one ship.	-- Webstar's Fictionary

Re: How can I sort newsgroups?
#43295
Author: Jeroen Scheerder
Date: Fri, 18 Sep 1998 00:00
23 lines
1170 bytes
admin@intergrafix.net:

> Is there any way to get it to sort my newsgroup list alphabetically (either
> ascending or descending)?

Exit tin.  :-)   In the shell, type

$ sort < $HOME/.newsrc > $HOME/.newsrc.sorted

The file .newsrc.sorted is now, well, sorted.

To make tin use it:

$ mv $HOME/.newsrc $HOME/.newsrc.unsorted
$ mv $HOME/.newsrc.sorted $HOME/.newsrc


-- J$
-- 
dash-dash-space 
this is my .sig                                          it's not so .big

Re: How can I sort newsgroups?
#43305
Author: Greg Berigan
Date: Sat, 19 Sep 1998 00:00
17 lines
1246 bytes
admin@intergrafix.net (admin@intergrafix.net) wrote:

> Hi, I'm using pre-version "Laura" of the TIN newsreader on linux.
>
> Is there any way to get it to sort my newsgroup list alphabetically (either
> ascending or descending)?

Sort your .newsrc file.  This won't affect the ordering in the active
file; that can only be changed by your news server administrator.

-- 
         ,=<#)-=#  <http://incolor.inetnebr.com/wotw/> (The War of the Worlds)
    ,_--//--_,
 _-~_-(####)-_~-_  If you feel that William Schlake is trolling ciwa.*,
(#>_--'~--~`--_<#) forward every offending posting to abuse@enteract.com.

Re: How can I sort newsgroups?
#43307
Author: Joerg Uecker
Date: Sat, 19 Sep 1998 00:00
54 lines
1945 bytes
<admin@intergrafix.net> wrote:

> Is there any way to get it to sort my newsgroup list alphabetically (either
> ascending or descending)?

Here ist another sripts for doing this:

#! /bin/sh
# Sorts the users's .newsrc as specified.
# Usage:  groupsort [name1] [name2] ...
# Found on Usenet, original author unknown (to jtbell@presby.edu, anyway).  

sort -o newnewsrc $HOME/.newsrc

# Alphabetized version of .newsrc temporarily saved as newnewsrc.
# Now put specified groups first, save as new .newsrc.
#
# For example, 'groupsort news.software news.admin news rec talk soc'
# sorts everything, then picks out groups beginning with news.software,
# then news.admin, then all news.* groups, then rec.*, talk.*, soc.*,
# in that order, and puts them at the top.
#
# Be sure to make this file executable: 'chmod +x groupsort'.

rm -f right left
touch right

for g in $* ; do
    egrep    "^$g" newnewsrc >> right
    egrep -v "^$g" newnewsrc >  left
    mv -f left newnewsrc
done

cat right newnewsrc > left
mv -f left newnewsrc
rm right

egrep    "^options " newnewsrc > right
egrep -v "^options " newnewsrc > left
mv -f left newnewsrc

egrep -v '!' newnewsrc >> right
egrep    '!' newnewsrc >  left
cat right left > newnewsrc
rm  right left

mv -f $HOME/.newsrc $HOME/.oldsrc    # Make a backup!
mv newnewsrc $HOME/.newsrc


-- 
J"org Uecker <ju@pirx.ruhr.de>

Re: How can I sort newsgroups?
#43312
Author: admin
Date: Sun, 20 Sep 1998 00:00
23 lines
1590 bytes
Greg Berigan <gberigan@cse.unl.edu> wrote:
> admin@intergrafix.net (admin@intergrafix.net) wrote:

>> Hi, I'm using pre-version "Laura" of the TIN newsreader on linux.
>>
>> Is there any way to get it to sort my newsgroup list alphabetically (either
>> ascending or descending)?

> Sort your .newsrc file.  This won't affect the ordering in the active
> file; that can only be changed by your news server administrator.

hehe, i am the news server administrator :)

-Cygnus
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.
Anthony J. Biacco                           Network Administrator/Engineer
admin@intergrafix.net                        Intergrafix Internet Services

          "The best way to predict the future, is to invent it."
http://cygnus.ncohafmuta.com                    http://www.intergrafix.net
.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-._.-.

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